Chromium Code Reviews| Index: LayoutTests/fast/forms/radio/radio-indeterminate-pseudo-class.html |
| diff --git a/LayoutTests/fast/forms/radio/radio-indeterminate-pseudo-class.html b/LayoutTests/fast/forms/radio/radio-indeterminate-pseudo-class.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a09ee1da6b168e4f715d3f069ff92e2266a67322 |
| --- /dev/null |
| +++ b/LayoutTests/fast/forms/radio/radio-indeterminate-pseudo-class.html |
| @@ -0,0 +1,81 @@ |
| +<html> |
| +<head> |
| +<script src="../../../resources/js-test.js"></script> |
| +</head> |
| +<body> |
| + |
| +<input id="r1_1" type="radio"> |
| + |
| +<input id="r2_1" name="r2" type="radio"> |
| +<input id="r2_2" name="r2" type="radio"> |
| +<input id="r2_3" name="r2" type="radio"> |
| + |
| +<input id="r3_1" name="r3" checked type="radio"> |
| + |
| +<input id="r4_1" name="r4" type="radio"> |
| +<input id="r4_2" name="r4" type="radio"> |
| + |
| +<script> |
| +description('This tests that radio buttons are checked by default, even when the name attribute is parsed after the checked attribute.'); |
| + |
| +function test1() { |
| + r1_1 = document.getElementById("r1_1"); |
| + // r1_1 is the single element in the radio group. |
| + debug('If a name isn\'t specified, it is in its own radio group.'); |
| + shouldBeTrue('r1_1.matches(":indeterminate")'); |
| + debug('Setting indeterminate property shouldn\'t affect radio buttons.'); |
| + r1_1.indeterminate = true; |
| + shouldBeTrue('r1_1.matches(":indeterminate")'); |
| + r1_1.checked = true; |
| + shouldBeFalse('r1_1.matches(":indeterminate")'); |
| + r1_1.indeterminate = false; |
| + shouldBeFalse('r1_1.matches(":indeterminate")'); |
| +} |
| + |
| +function test2() { |
| + 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.
|
| + 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.
|
| + r2_2 = document.getElementById("r2_2"); |
| + r2_3 = document.getElementById("r2_3"); |
| + shouldBeTrue('r2_1.matches(":indeterminate")'); |
| + shouldBeTrue('r2_2.matches(":indeterminate")'); |
| + shouldBeTrue('r2_3.matches(":indeterminate")'); |
| + r2_1.checked = true; |
| + shouldBeFalse('r2_1.matches(":indeterminate")'); |
| + shouldBeFalse('r2_2.matches(":indeterminate")'); |
| + shouldBeFalse('r2_3.matches(":indeterminate")'); |
| + r2_2.checked = true; |
| + shouldBeFalse('r2_1.matches(":indeterminate")'); |
| + shouldBeFalse('r2_2.matches(":indeterminate")'); |
| + shouldBeFalse('r2_3.matches(":indeterminate")'); |
| + r2_2.checked = false; |
| + shouldBeTrue('r2_1.matches(":indeterminate")'); |
| + shouldBeTrue('r2_2.matches(":indeterminate")'); |
| + shouldBeTrue('r2_3.matches(":indeterminate")'); |
| +} |
| + |
| +function test3() { |
| + debug('Adding/removing a button from a group should affect the matching.'); |
| + r3_1 = document.getElementById("r3_1"); |
|
tkent
2014/07/15 01:31:50
Ditto.
keishi
2014/07/15 03:05:29
Done.
|
| + r4_1 = document.getElementById("r4_1"); |
| + r4_2 = document.getElementById("r4_2"); |
| + shouldBeFalse('r3_1.matches(":indeterminate")'); |
| + shouldBeTrue('r4_1.matches(":indeterminate")'); |
| + shouldBeTrue('r4_2.matches(":indeterminate")'); |
| + r3_1.name = "r4"; |
| + shouldBeFalse('r3_1.matches(":indeterminate")'); |
| + shouldBeFalse('r4_1.matches(":indeterminate")'); |
| + shouldBeFalse('r4_2.matches(":indeterminate")'); |
| + r3_1.name = "r3"; |
| + shouldBeFalse('r3_1.matches(":indeterminate")'); |
| + shouldBeTrue('r4_1.matches(":indeterminate")'); |
| + shouldBeTrue('r4_2.matches(":indeterminate")'); |
| +} |
| + |
| +test1(); |
| +test2(); |
| +test3(); |
| + |
| +</script> |
| +</body> |
| +</html> |