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

Side by Side Diff: LayoutTests/fast/forms/radio-checkbox-events-order.html

Issue 1188763002: Click event should be fired before change events for checkbox and radio button. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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/radio-checkbox-events-order-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 HTML>
2
3 <script src="../../resources/js-test.js"></script>
4
5 <body>
6 <input type="checkbox" id="checkbox-btn1" onclick="doClickAction(event)" onchang e="doChangeAction(event)"/>
7 <input type="checkbox" id="checkbox-btn2" onclick="doClickAction(event); event.p reventDefault()" onchange="doChangeAction(event)"/>
8 <input type="radio" id="radio-btn1" onclick="doClickAction(event)" onchange="doC hangeAction(event)"/>
9 <input type="radio" id="radio-btn2" onclick="doClickAction(event); event.prevent Default()" onchange="doChangeAction(event)"/>
10 <script>
11 description('Tests the order of onclick and onchange');
12 var message = '';
13
14 function doClickAction(e)
15 {
16 shouldBeEqualToString('message', '');
17 message = 'clicked';
18 }
19
20 function doChangeAction(e)
21 {
22 shouldBeEqualToString('message', 'clicked');
23 message = 'changed';
24 }
25
26 var checkbox1 = document.getElementById('checkbox-btn1');
27 var checkbox2 = document.getElementById('checkbox-btn2');
28 var radio1 = document.getElementById('radio-btn1');
29 var radio2 = document.getElementById('radio-btn2');
30
31 message = '';
32 checkbox1.click();
33 shouldBeEqualToString('message', 'changed');
34 shouldBeTrue('checkbox1.checked');
35
36 message = '';
37 checkbox1.click();
38 shouldBeEqualToString('message', 'changed');
39 shouldBeFalse('checkbox1.checked');
40
41 message = '';
42 checkbox2.click();
43 shouldBeEqualToString('message', 'clicked');
44 shouldBeFalse('checkbox2.checked');
45
46 message = '';
47 checkbox1.checked = false;
48 checkbox1.focus();
49 eventSender.keyDown(' ');
50 shouldBeEqualToString('message', 'changed');
51 shouldBeTrue('checkbox1.checked');
52
53 message = '';
54 checkbox1.focus();
55 eventSender.keyDown(' ');
56 shouldBeEqualToString('message', 'changed');
57 shouldBeFalse('checkbox1.checked');
58
59 message = '';
60 checkbox2.checked = false;
61 checkbox2.focus();
62 eventSender.keyDown(' ');
63 shouldBeEqualToString('message', 'clicked');
64 shouldBeFalse('checkbox2.checked');
65
66 message = '';
67 radio1.click();
68 shouldBeEqualToString('message', 'changed');
69 shouldBeTrue('radio1.checked');
70
71 message = '';
72 radio1.click();
73 shouldBeEqualToString('message', 'clicked');
74 shouldBeTrue('radio1.checked');
75
76 message = '';
77 radio2.click();
78 shouldBeEqualToString('message', 'clicked');
79 shouldBeFalse('radio2.checked');
80
81 message = '';
82 radio1.checked = false;
83 radio1.focus();
84 eventSender.keyDown(' ');
85 shouldBeEqualToString('message', 'changed');
86 shouldBeTrue('radio1.checked');
87
88 message = '';
89 radio1.focus();
90 eventSender.keyDown(' ');
91 shouldBeEqualToString('message', '');
92 shouldBeTrue('radio1.checked');
93
94 message = '';
95 radio2.checked = false;
96 radio2.focus();
97 eventSender.keyDown(' ');
98 shouldBeEqualToString('message', 'clicked');
99 shouldBeFalse('radio2.checked');
100
101 </script>
102 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/forms/radio-checkbox-events-order-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698