Index: LayoutTests/fast/forms/select/popup-menu-touch-operations.html |
diff --git a/LayoutTests/fast/forms/select/popup-menu-touch-operations.html b/LayoutTests/fast/forms/select/popup-menu-touch-operations.html |
index 00be550836b6f738df30e7b8cd8df723b9f78413..f90c3f7a327326c773928cd5759b2061be62c945 100644 |
--- a/LayoutTests/fast/forms/select/popup-menu-touch-operations.html |
+++ b/LayoutTests/fast/forms/select/popup-menu-touch-operations.html |
@@ -11,8 +11,40 @@ |
<option selected>bar</option> |
<option>baz</option> |
</select> |
+<select id="menu2"> |
+ <option>1</option> |
+ <option selected>2</option> |
+ <option>3</option> |
+ <option>4</option> |
+ <option>5</option> |
+ <option>6</option> |
+ <option>7</option> |
+ <option>8</option> |
+ <option>9</option> |
+ <option>10</option> |
+ <option>11</option> |
+ <option>12</option> |
+ <option>13</option> |
+ <option>14</option> |
+ <option>15</option> |
+ <option>16</option> |
+ <option>17</option> |
+ <option>18</option> |
+ <option>19</option> |
+ <option>20</option> |
+ <option>21</option> |
+ <option>22</option> |
+ <option>23</option> |
+ <option>24</option> |
+ <option>25</option> |
+ <option>26</option> |
+ <option>27</option> |
+ <option>28</option> |
+ <option>29</option> |
+</select> |
<script> |
var menuElement = document.getElementById('menu'); |
+var menuElement2 = document.getElementById('menu2'); |
var picker = null; |
eventSender.clearTouchPoints(); |
openPicker(menuElement, function () { |
@@ -36,11 +68,53 @@ openPicker(menuElement, function () { |
shouldBeNull('window.internals.pagePopupWindow'); |
shouldBeEqualToString('menuElement.value', 'baz'); |
- finishJSTest(); |
+ test2(); |
}, function () { |
testFailed('picker didn\'t open') |
finishJSTest(); |
}); |
+ |
+function test2() { |
+ openPicker(menuElement2, function () { |
+ picker = window.internals.pagePopupWindow.global.picker; |
+ shouldBeEqualToString('picker._selectElement.value', '1'); |
+ shouldBeEqualToString('menuElement2.value', '2'); |
+ |
+ var position = elementCenterPosition(picker._selectElement.children[2]); |
+ eventSender.addTouchPoint(position[0], position[1]); |
+ eventSender.touchStart(); |
+ shouldBeEqualToString('picker._selectElement.value', '2'); |
+ |
+ position = elementCenterPosition(picker._selectElement.children[3]); |
+ eventSender.updateTouchPoint(0, position[0], position[1]); |
+ eventSender.touchMove(); |
+ shouldBeEqualToString('picker._selectElement.value', '3'); |
+ |
+ // Moving touch up should scroll and end touch select mode. |
+ position = elementCenterPosition(picker._selectElement.children[0]); |
+ eventSender.updateTouchPoint(0, position[0], position[1]); |
+ eventSender.touchMove(); |
+ eventSender.gestureScrollBegin(position[0], position[1]); |
+ eventSender.gestureScrollUpdate(0, -130); |
+ setTimeout(test2AfterScrollEvent, 1000); |
+ }, function () { |
+ testFailed('picker didn\'t open') |
+ finishJSTest(); |
+ }); |
+} |
+ |
+function test2AfterScrollEvent() { |
+ // touchmove event fires before the scroll event so the selection will change. |
+ shouldBeEqualToString('picker._selectElement.value', '0'); |
+ eventSender.releaseTouchPoint(0); |
+ eventSender.touchEnd(); |
+ eventSender.gestureScrollEnd(0, 0); |
+ |
+ shouldNotBe('window.internals.pagePopupWindow', 'null'); |
+ shouldBeEqualToString('menuElement2.value', '2'); |
+ |
+ finishJSTest(); |
+} |
</script> |
</body> |
</html> |