| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
| 5 <script src="../resources/common.js"></script> | 5 <script src="../resources/common.js"></script> |
| 6 <script src="../resources/picker-common.js"></script> | 6 <script src="../resources/picker-common.js"></script> |
| 7 </head> | 7 </head> |
| 8 <body> | 8 <body> |
| 9 <select id="menu"> | 9 <select id="menu"> |
| 10 <option>foo</option> | 10 <option>foo</option> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 eventSender.updateTouchPoint(0, position[0], position[1]); | 61 eventSender.updateTouchPoint(0, position[0], position[1]); |
| 62 eventSender.touchMove(); | 62 eventSender.touchMove(); |
| 63 shouldBeEqualToString('picker._selectElement.value', '2'); | 63 shouldBeEqualToString('picker._selectElement.value', '2'); |
| 64 | 64 |
| 65 eventSender.releaseTouchPoint(0); | 65 eventSender.releaseTouchPoint(0); |
| 66 eventSender.touchEnd(); | 66 eventSender.touchEnd(); |
| 67 | 67 |
| 68 shouldBeNull('window.internals.pagePopupWindow'); | 68 shouldBeNull('window.internals.pagePopupWindow'); |
| 69 shouldBeEqualToString('menuElement.value', 'baz'); | 69 shouldBeEqualToString('menuElement.value', 'baz'); |
| 70 | 70 |
| 71 test2(); | 71 testDisabled(); |
| 72 }, function () { | 72 }, function () { |
| 73 testFailed('picker didn\'t open') | 73 testFailed('picker didn\'t open') |
| 74 finishJSTest(); | 74 finishJSTest(); |
| 75 }); | 75 }); |
| 76 | 76 |
| 77 function testDisabled() { |
| 78 debug("==> Test disabled option"); |
| 79 menuElement.options[0].disabled = true; |
| 80 openPicker(menuElement, () => { |
| 81 picker = window.internals.pagePopupWindow.global.picker; |
| 82 shouldBeEqualToString('picker._selectElement.value', '2'); |
| 83 shouldBeEqualToString('menuElement.value', 'baz'); |
| 84 |
| 85 var position = elementCenterPosition(picker._selectElement.children[2]); |
| 86 eventSender.addTouchPoint(position[0], position[1]); |
| 87 eventSender.touchStart(); |
| 88 shouldBeEqualToString('picker._selectElement.value', '2'); |
| 89 |
| 90 position = elementCenterPosition(picker._selectElement.children[0]); |
| 91 eventSender.updateTouchPoint(0, position[0], position[1]); |
| 92 eventSender.touchMove(); |
| 93 // The value is still 2 because children[0] is disabled. |
| 94 shouldBeEqualToString('picker._selectElement.value', '2'); |
| 95 |
| 96 eventSender.releaseTouchPoint(0); |
| 97 eventSender.touchEnd(); |
| 98 |
| 99 shouldNotBe('window.internals.pagePopupWindow', 'null'); |
| 100 shouldBeEqualToString('menuElement.value', 'baz'); |
| 101 |
| 102 test2(); |
| 103 }, function () { |
| 104 testFailed('picker didn\'t open') |
| 105 finishJSTest(); |
| 106 }); |
| 107 } |
| 108 |
| 77 function test2() { | 109 function test2() { |
| 110 debug("==> Test scrollable popup"); |
| 78 openPicker(menuElement2, function () { | 111 openPicker(menuElement2, function () { |
| 79 picker = window.internals.pagePopupWindow.global.picker; | 112 picker = window.internals.pagePopupWindow.global.picker; |
| 80 shouldBeEqualToString('picker._selectElement.value', '1'); | 113 shouldBeEqualToString('picker._selectElement.value', '1'); |
| 81 shouldBeEqualToString('menuElement2.value', '2'); | 114 shouldBeEqualToString('menuElement2.value', '2'); |
| 82 | 115 |
| 83 var position = elementCenterPosition(picker._selectElement.children[2]); | 116 var position = elementCenterPosition(picker._selectElement.children[2]); |
| 84 eventSender.addTouchPoint(position[0], position[1]); | 117 eventSender.addTouchPoint(position[0], position[1]); |
| 85 eventSender.touchStart(); | 118 eventSender.touchStart(); |
| 86 shouldBeEqualToString('picker._selectElement.value', '2'); | 119 shouldBeEqualToString('picker._selectElement.value', '2'); |
| 87 | 120 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 111 eventSender.gestureScrollEnd(0, 0); | 144 eventSender.gestureScrollEnd(0, 0); |
| 112 | 145 |
| 113 shouldNotBe('window.internals.pagePopupWindow', 'null'); | 146 shouldNotBe('window.internals.pagePopupWindow', 'null'); |
| 114 shouldBeEqualToString('menuElement2.value', '2'); | 147 shouldBeEqualToString('menuElement2.value', '2'); |
| 115 | 148 |
| 116 finishJSTest(); | 149 finishJSTest(); |
| 117 } | 150 } |
| 118 </script> | 151 </script> |
| 119 </body> | 152 </body> |
| 120 </html> | 153 </html> |
| OLD | NEW |