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

Unified 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 side-by-side diff with in-line comments
Download patch
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..13b2cdcc013432bf973883ce030694d264cfd13b
--- /dev/null
+++ b/LayoutTests/fast/forms/radio/radio-indeterminate-pseudo-class.html
@@ -0,0 +1,80 @@
+<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 :indeterminate pseudo class matches when there is no checked radio button in a radio button group.');
+
+function test1() {
+ r1_1 = document.getElementById("r1_1");
tkent 2014/07/28 03:12:09 Inconsistent quotes. Other lines have single quot
keishi 2014/09/02 03:49:53 Done.
+ 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.');
+ r2_1 = document.getElementById("r2_1");
tkent 2014/07/28 03:12:09 Ditto.
keishi 2014/09/02 03:49:53 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/28 03:12:09 Ditto.
keishi 2014/09/02 03:49:53 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>

Powered by Google App Engine
This is Rietveld 408576698