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

Side by Side Diff: LayoutTests/fast/forms/number/number-spinbutton-changeevent-trigger.html

Issue 196933006: Do not dispatch 'change' events during pressing spin buttons for input[type=number]. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test code updated 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
« no previous file with comments | « no previous file | LayoutTests/fast/forms/number/number-spinbutton-changeevent-trigger-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE>
2 <html>
3 <body>
4 <script src="../../../resources/js-test.js"></script>
5 <script src="../resources/common.js"></script>
6 <input type="number" id="num1" onchange="handleChangeEvent(this);" oninput="hand leInputEvent(this);">
7 <script>
8 var changeEventCounter = 0;
9 var inputEventCounter = 0;
10
11 function handleChangeEvent(element) {
12 ++changeEventCounter;
13 }
14
15 function handleInputEvent(element) {
16 ++inputEventCounter;
17 }
18
19 var numberInput1= document.getElementById('num1');
20 numberInput1.focus();
21 debug('Should not trigger any event');
22 hoverOverElement(numberInput1);
23 shouldBe('inputEventCounter', '0');
24 shouldBe('changeEventCounter', '0');
25
26 numberInput1.value = 0;
27 eventSender.mouseMoveTo(numberInput1.offsetLeft + numberInput1.offsetWidth - 10, numberInput1.offsetTop + numberInput1.offsetHeight / 4);
28 eventSender.mouseDown();
29 debug('Input event is triggered but no change event is triggered on mouse down') ;
30 shouldBe('inputEventCounter', '1');
31 shouldBe('changeEventCounter', '0');
32 shouldBeEqualToString('numberInput1.value', '1');
33 eventSender.mouseUp();
34 debug('Change events occurs on mouse up');
35 shouldBe('inputEventCounter', '1');
36 shouldBe('changeEventCounter', '1');
37 shouldBeEqualToString('numberInput1.value', '1');
38
39 debug('Pressed more than once, still events are triggered');
40 eventSender.mouseMoveTo(numberInput1.offsetLeft + numberInput1.offsetWidth - 10, numberInput1.offsetTop + numberInput1.offsetHeight / 4);
41 eventSender.mouseDown();
42 eventSender.mouseUp();
43 shouldBe('inputEventCounter', '2');
44 shouldBe('changeEventCounter', '2');
45 shouldBeEqualToString('numberInput1.value', '2');
46
47 debug('When moving away from field, it should not trigger event, only on value c hange');
48 numberInput1.blur();
49 shouldBe('inputEventCounter', '2');
50 shouldBe('changeEventCounter', '2');
51 shouldBeEqualToString('numberInput1.value', '2');
52
53 </script>
54 </body>
55 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/forms/number/number-spinbutton-changeevent-trigger-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698