OLD | NEW |
(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 :indeterminate pseudo class matches when there is no che
cked radio button in a radio button group.'); |
| 20 |
| 21 function test1() { |
| 22 r1_1 = document.getElementById('r1_1'); |
| 23 debug('If a name isn\'t specified, it is in its own radio group.'); |
| 24 shouldBeTrue('r1_1.matches(":indeterminate")'); |
| 25 debug('Setting indeterminate property shouldn\'t affect radio buttons.'); |
| 26 r1_1.indeterminate = true; |
| 27 shouldBeTrue('r1_1.matches(":indeterminate")'); |
| 28 r1_1.checked = true; |
| 29 shouldBeFalse('r1_1.matches(":indeterminate")'); |
| 30 r1_1.indeterminate = false; |
| 31 shouldBeFalse('r1_1.matches(":indeterminate")'); |
| 32 } |
| 33 |
| 34 function test2() { |
| 35 debug('Changing checked should affect the matching of other buttons within t
he radio group.'); |
| 36 r2_1 = document.getElementById('r2_1'); |
| 37 r2_2 = document.getElementById('r2_2'); |
| 38 r2_3 = document.getElementById('r2_3'); |
| 39 shouldBeTrue('r2_1.matches(":indeterminate")'); |
| 40 shouldBeTrue('r2_2.matches(":indeterminate")'); |
| 41 shouldBeTrue('r2_3.matches(":indeterminate")'); |
| 42 r2_1.checked = true; |
| 43 shouldBeFalse('r2_1.matches(":indeterminate")'); |
| 44 shouldBeFalse('r2_2.matches(":indeterminate")'); |
| 45 shouldBeFalse('r2_3.matches(":indeterminate")'); |
| 46 r2_2.checked = true; |
| 47 shouldBeFalse('r2_1.matches(":indeterminate")'); |
| 48 shouldBeFalse('r2_2.matches(":indeterminate")'); |
| 49 shouldBeFalse('r2_3.matches(":indeterminate")'); |
| 50 r2_2.checked = false; |
| 51 shouldBeTrue('r2_1.matches(":indeterminate")'); |
| 52 shouldBeTrue('r2_2.matches(":indeterminate")'); |
| 53 shouldBeTrue('r2_3.matches(":indeterminate")'); |
| 54 } |
| 55 |
| 56 function test3() { |
| 57 debug('Adding/removing a button from a group should affect the matching.'); |
| 58 r3_1 = document.getElementById('r3_1'); |
| 59 r4_1 = document.getElementById('r4_1'); |
| 60 r4_2 = document.getElementById('r4_2'); |
| 61 shouldBeFalse('r3_1.matches(":indeterminate")'); |
| 62 shouldBeTrue('r4_1.matches(":indeterminate")'); |
| 63 shouldBeTrue('r4_2.matches(":indeterminate")'); |
| 64 r3_1.name = 'r4'; |
| 65 shouldBeFalse('r3_1.matches(":indeterminate")'); |
| 66 shouldBeFalse('r4_1.matches(":indeterminate")'); |
| 67 shouldBeFalse('r4_2.matches(":indeterminate")'); |
| 68 r3_1.name = 'r3'; |
| 69 shouldBeFalse('r3_1.matches(":indeterminate")'); |
| 70 shouldBeTrue('r4_1.matches(":indeterminate")'); |
| 71 shouldBeTrue('r4_2.matches(":indeterminate")'); |
| 72 } |
| 73 |
| 74 test1(); |
| 75 test2(); |
| 76 test3(); |
| 77 |
| 78 </script> |
| 79 </body> |
| 80 </html> |
OLD | NEW |