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

Side by Side Diff: LayoutTests/fast/forms/radio/radio-indeterminate-pseudo-class.html

Issue 394433002: Add :indeterminate pseudo class support for radio button input (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../../resources/js-test.js"></script>
4 </head>
5 <body>
6
7 <input id="r1_1" type="radio">
8
9 <input id="r2_1" name="r2" type="radio">
10 <input id="r2_2" name="r2" type="radio">
11 <input id="r2_3" name="r2" type="radio">
12
13 <input id="r3_1" name="r3" checked type="radio">
14
15 <input id="r4_1" name="r4" type="radio">
16 <input id="r4_2" name="r4" type="radio">
17
18 <script>
19 description('This tests that radio buttons are checked by default, even when the name attribute is parsed after the checked attribute.');
20
21 function test1() {
22 r1_1 = document.getElementById("r1_1");
23 // r1_1 is the single element in the radio group.
24 debug('If a name isn\'t specified, it is in its own radio group.');
25 shouldBeTrue('r1_1.matches(":indeterminate")');
26 debug('Setting indeterminate property shouldn\'t affect radio buttons.');
27 r1_1.indeterminate = true;
28 shouldBeTrue('r1_1.matches(":indeterminate")');
29 r1_1.checked = true;
30 shouldBeFalse('r1_1.matches(":indeterminate")');
31 r1_1.indeterminate = false;
32 shouldBeFalse('r1_1.matches(":indeterminate")');
33 }
34
35 function test2() {
36 debug('Changing checked should affect the matching of other buttons within the radio group.');
tkent 2014/07/15 01:31:50 nit: Extra space between "should" and "affect".
keishi 2014/07/15 03:05:30 Done.
37 r2_1 = document.getElementById("r2_1");
tkent 2014/07/15 01:31:50 nit: extra space after '='.
keishi 2014/07/15 03:05:29 Done.
38 r2_2 = document.getElementById("r2_2");
39 r2_3 = document.getElementById("r2_3");
40 shouldBeTrue('r2_1.matches(":indeterminate")');
41 shouldBeTrue('r2_2.matches(":indeterminate")');
42 shouldBeTrue('r2_3.matches(":indeterminate")');
43 r2_1.checked = true;
44 shouldBeFalse('r2_1.matches(":indeterminate")');
45 shouldBeFalse('r2_2.matches(":indeterminate")');
46 shouldBeFalse('r2_3.matches(":indeterminate")');
47 r2_2.checked = true;
48 shouldBeFalse('r2_1.matches(":indeterminate")');
49 shouldBeFalse('r2_2.matches(":indeterminate")');
50 shouldBeFalse('r2_3.matches(":indeterminate")');
51 r2_2.checked = false;
52 shouldBeTrue('r2_1.matches(":indeterminate")');
53 shouldBeTrue('r2_2.matches(":indeterminate")');
54 shouldBeTrue('r2_3.matches(":indeterminate")');
55 }
56
57 function test3() {
58 debug('Adding/removing a button from a group should affect the matching.');
59 r3_1 = document.getElementById("r3_1");
tkent 2014/07/15 01:31:50 Ditto.
keishi 2014/07/15 03:05:29 Done.
60 r4_1 = document.getElementById("r4_1");
61 r4_2 = document.getElementById("r4_2");
62 shouldBeFalse('r3_1.matches(":indeterminate")');
63 shouldBeTrue('r4_1.matches(":indeterminate")');
64 shouldBeTrue('r4_2.matches(":indeterminate")');
65 r3_1.name = "r4";
66 shouldBeFalse('r3_1.matches(":indeterminate")');
67 shouldBeFalse('r4_1.matches(":indeterminate")');
68 shouldBeFalse('r4_2.matches(":indeterminate")');
69 r3_1.name = "r3";
70 shouldBeFalse('r3_1.matches(":indeterminate")');
71 shouldBeTrue('r4_1.matches(":indeterminate")');
72 shouldBeTrue('r4_2.matches(":indeterminate")');
73 }
74
75 test1();
76 test2();
77 test3();
78
79 </script>
80 </body>
81 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698