1 <script src=
"../../../resources/js-test.js"></script>
3 <menuitem id=mi1 type=checkbox
>
4 <menuitem id=mi2 type=radio
radiogroup=
"g1" checked
>
5 <menuitem id=mi3 type=radio
radiogroup=
"g1">
6 <menuitem id=mi4 type=radio
radiogroup=
"g1">
8 <menuitem id=_mi1 type=radio
radiogroup=
"g1">
9 <menuitem id=_mi2 type=radio
radiogroup=
"g1">
10 <menuitem id=_mi3 type=radio
radiogroup=
"g1">
12 <menuitem id=mi5 type=radio
radiogroup=
"g2" checked
>
13 <menuitem id=mi6 type=radio
radiogroup=
"G2">
14 <menuitem id=mi7 type=radio
radiogroup=
" g3 " checked
>
15 <menuitem id=mi8 type=radio
radiogroup=
" g3">
16 <menuitem id=mi9 type=radio
radiogroup=
"" checked
>
17 <menuitem id=mi10 type=radio
>
18 <menuitem id=mi11 type=radio
radiogroup=
"g4">
19 <menuitem id=mi12 type=checkbox
radiogroup=
"g4" checked
>
23 description('Test that the "checked" attribute of menuitem is toggled with click.');
25 var element
= document
.getElementById('mi1');
27 shouldBeTrue('element.hasAttribute("checked")');
29 shouldBeFalse('element.hasAttribute("checked")');
30 var mi2
= document
.getElementById('mi2');
31 var mi3
= document
.getElementById('mi3');
32 var mi4
= document
.getElementById('mi4');
33 shouldBeTrue('mi2.hasAttribute("checked")');
35 shouldBeFalse('mi2.hasAttribute("checked")');
36 shouldBeTrue('mi3.hasAttribute("checked")');
38 shouldBeFalse('mi3.hasAttribute("checked")');
39 shouldBeTrue('mi4.hasAttribute("checked")');
40 // Test clicking menuitem of type=radio which is already checked.
42 shouldBeTrue('mi4.hasAttribute("checked")');
43 // Test radiogroup in a submenu.
44 var _mi1
= document
.getElementById('_mi1');
46 shouldBeTrue('mi4.hasAttribute("checked")');
47 shouldBeTrue('_mi1.hasAttribute("checked")');
48 // Test radiogroup case matching.
49 var mi5
= document
.getElementById('mi5');
50 var mi6
= document
.getElementById('mi6');
52 shouldBeTrue('mi5.hasAttribute("checked")');
53 shouldBeTrue('mi6.hasAttribute("checked")');
54 // Test radiogroup white space matching.
55 var mi7
= document
.getElementById('mi7');
56 var mi8
= document
.getElementById('mi8');
58 shouldBeTrue('mi7.hasAttribute("checked")');
59 shouldBeTrue('mi8.hasAttribute("checked")');
60 // Test empty radiogroup.
61 var mi9
= document
.getElementById('mi9');
62 var mi10
= document
.getElementById('mi10');
64 shouldBeFalse('mi9.hasAttribute("checked")');
65 shouldBeTrue('mi10.hasAttribute("checked")');
66 // Test that radiogroup attribute is ignored if type is not radio.
67 var mi11
= document
.getElementById('mi11');
68 var mi12
= document
.getElementById('mi12');
70 shouldBeTrue('mi11.hasAttribute("checked")');
71 shouldBeFalse('mi12.hasAttribute("checked")');