Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: LayoutTests/fast/forms/resources/common-spinbutton-change-and-input-events.js

Issue 228633003: Do not dispatch change event when pressing spin button for input type=datetime (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Detach handling for DateTime field Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 var inputEventCounter = 0; 1 var inputEventCounter = 0;
2 var changeEventCounter = 0; 2 var changeEventCounter = 0;
3 var testInput; 3 var testInput;
4 4
5 function testSpinButtonChangeAndInputEvents(inputType, initialValue, expectedVal ue, maximumValue) 5 function testSpinButtonChangeAndInputEvents(inputType, initialValue, expectedVal ue, maximumValue)
6 { 6 {
7 description('Test for event dispatching by spin buttons in a type=' + inputT ype + ' input.'); 7 description('Test for event dispatching by spin buttons in a type=' + inputT ype + ' input.');
8 if (!window.eventSender) { 8 if (!window.eventSender) {
9 debug('No eventSender'); 9 debug('No eventSender');
10 return; 10 return;
(...skipping 16 matching lines...) Expand all
27 eventSender.mouseMoveTo(0, 0); 27 eventSender.mouseMoveTo(0, 0);
28 shouldEvaluateTo('changeEventCounter', 0); 28 shouldEvaluateTo('changeEventCounter', 0);
29 shouldEvaluateTo('inputEventCounter', 0); 29 shouldEvaluateTo('inputEventCounter', 0);
30 testInput.focus(); 30 testInput.focus();
31 31
32 debug('Click the upper button'); 32 debug('Click the upper button');
33 // Move the cursor on the upper button. 33 // Move the cursor on the upper button.
34 var spinButton = getElementByPseudoId(internals.oldestShadowRoot(testInput), "-webkit-inner-spin-button"); 34 var spinButton = getElementByPseudoId(internals.oldestShadowRoot(testInput), "-webkit-inner-spin-button");
35 eventSender.mouseMoveTo(testInput.offsetLeft + spinButton.offsetLeft, testIn put.offsetTop + testInput.offsetHeight / 4); 35 eventSender.mouseMoveTo(testInput.offsetLeft + spinButton.offsetLeft, testIn put.offsetTop + testInput.offsetHeight / 4);
36 eventSender.mouseDown(); 36 eventSender.mouseDown();
37 debug('Triggers only input event on mouseDown');
38 shouldBeEqualToString('testInput.value', expectedValue);
39 shouldEvaluateTo('changeEventCounter', 0);
40 shouldEvaluateTo('inputEventCounter', 1);
41 debug('Triggers only change event on mouseUp');
37 eventSender.mouseUp(); 42 eventSender.mouseUp();
38 shouldBeEqualToString('testInput.value', expectedValue); 43 shouldBeEqualToString('testInput.value', expectedValue);
39 shouldEvaluateTo('changeEventCounter', 1); 44 shouldEvaluateTo('changeEventCounter', 1);
40 shouldEvaluateTo('inputEventCounter', 1); 45 shouldEvaluateTo('inputEventCounter', 1);
41 46
42 if (testInput.hasAttribute("max")) { 47 if (testInput.hasAttribute("max")) {
43 debug('Click again, but the value is not changed.'); 48 debug('Click again, but the value is not changed.');
44 eventSender.mouseDown(); 49 eventSender.mouseDown();
45 eventSender.mouseUp(); 50 eventSender.mouseUp();
46 shouldBeEqualToString('testInput.value', expectedValue); 51 shouldBeEqualToString('testInput.value', expectedValue);
47 shouldEvaluateTo('changeEventCounter', 1); 52 shouldEvaluateTo('changeEventCounter', 1);
48 shouldEvaluateTo('inputEventCounter', 1); 53 shouldEvaluateTo('inputEventCounter', 1);
49 } 54 }
50 55
51 debug('Focus on another field'); 56 debug('Focus on another field');
52 anotherInput.focus(); 57 anotherInput.focus();
53 shouldEvaluateTo('changeEventCounter', 1); 58 shouldEvaluateTo('changeEventCounter', 1);
54 shouldEvaluateTo('inputEventCounter', 1); 59 shouldEvaluateTo('inputEventCounter', 1);
55 60
56 parent.innerHTML = ''; 61 parent.innerHTML = '';
57 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698