<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../resources/testdriver.js"></script>
<script src="../../../resources/testdriver-actions.js"></script>
<script src="../../../resources/testdriver-vendor.js"></script>
<script src="../resources/common.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<script src="../resources/picker-common.js"></script>
<select>
<option>option1</option>
<option>option2</option>
<option>option3</option>
<option>option4</option>
<option>option5</option>
<option>option6</option>
<option>option7</option>
<option>option8</option>
<option>option9</option>
<option>option10</option>
<option>option11</option>
<option>option12</option>
<option>option13</option>
<option>option14</option>
<option>option15</option>
<option>option16</option>
<option>option17</option>
<option>option18</option>
<option>option19</option>
<option>option20</option>
<option>option21</option>
<option>option22</option>
<option>option23</option>
<option>option24</option>
<option>option25</option>
<option>option26</option>
<option>option27</option>
<option>option28</option>
</select>
<script>
internals.settings.setScrollAnimatorEnabled(false);
promise_test(() => {
const menu = document.querySelector('select');
return openPicker(menu)
.then(() => {
// Click on the scrollbar forward button, and then validate
// that the scrollbar/scrollable area scrolled.
let innerSelectRect = internals.pagePopupWindow.global.picker.selectElement_.getBoundingClientRect();
let scrollbarX = innerSelectRect.x + innerSelectRect.width - 5 + internals.pagePopupWindow.screenX;
let scrollbarY = innerSelectRect.y + innerSelectRect.height - 10 + internals.pagePopupWindow.screenY;
return (new test_driver.Actions())
.pointerMove(scrollbarX, scrollbarY)
.pointerDown()
.pointerUp()
.send();
})
.then(requestAnimationFramePromise())
.then(requestAnimationFramePromise())
.then(() => {
assert_not_equals(internals.pagePopupWindow, null, "The click shouldn't have closed the window");
assert_greater_than(internals.pagePopupWindow.global.picker.selectElement_.scrollTop, 0);
});
}, "Scrollbar clicks in a popup must scroll");
</script>