4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"../resources/common.js"></script>
6 <script src=
"../resources/picker-common.js"></script>
10 <option selected
>foo
</option>
12 <option hidden
>baz
</option>
13 <optgroup label=
"qux">
14 <option>garply
</option>
18 var menuElement
= document
.getElementById('menu');
21 function openPickerErrorCallback() {
22 testFailed('picker didn\'t open')
25 openPicker(menu
, test1
, openPickerErrorCallback
);
28 picker
= window
.internals
.pagePopupWindow
.global
.picker
;
31 setTimeout(function() {
32 shouldBeEqualToString('picker._selectElement.style.color', 'rgb(123, 0, 0)');
33 shouldBeEqualToString('picker._selectElement.options[0].style.color', '');
34 picker
.removeListener("didUpdate", onUpdate
);
38 picker
.on("didUpdate", onUpdate
);
39 menuElement
.style
.color
= 'rgb(123, 0, 0)';
43 hoverOverElement(picker
._selectElement
.children
[0]);
44 shouldBeEqualToString('picker._selectElement.value', '0');
45 eventSender
.keyDown('downArrow');
46 shouldBeEqualToString('picker._selectElement.value', '1');
48 picker
.on("didUpdate", onUpdate
);
49 menuElement
.innerHTML
= '<option>FOO</option><option>BAR</option><optgroup label="BAZ"></optgroup>';
52 setTimeout(function() {
53 shouldBeEqualToString('picker._selectElement.value', '1');
54 shouldBe('picker._selectElement.options.length', '2');
55 shouldBeEqualToString('picker._selectElement.children[0].label', 'FOO');
56 shouldBeEqualToString('picker._selectElement.children[1].label', 'BAR');
57 shouldBeEqualToString('picker._selectElement.children[2].tagName', 'OPTGROUP');
58 shouldBeEqualToString('picker._selectElement.children[2].label', 'BAZ');
59 picker
.removeListener("didUpdate", onUpdate
);
66 hoverOverElement(picker
._selectElement
.children
[2]);
67 shouldBeEqualToString('picker._selectElement.value', '1');
69 menuElement
.innerHTML
= '<option>FOO</option><option>BAR</option><option selected>QUX</option>';
71 picker
.on("didUpdate", function () {
72 setTimeout(function () {
73 shouldBeEqualToString('picker._selectElement.value', '2');