Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / select / listbox-click-on-scrollbar.html
blob9fcaf5030a52a0e2bdf3fcbb39235ce6d96e4aa8
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../../resources/js-test.js"></script>
5 <select id="select1" multiple size="4">
6 <option>1</option>
7 <option>2</option>
8 <option>3</option>
9 <option>4</option>
10 <option>5</option>
11 <option>6</option>
12 <option>7</option>
13 <option>8</option>
14 </select>
16 <script>
17 description('Click on a listbox scrollbar should not dispatch change evnet.');
18 jsTestIsAsync = true;
19 var select1 = document.getElementById('select1');
20 var changeEventCounter = 0;
21 select1.onchange = function() {
22 debug('A change event was dispatched.');
23 ++changeEventCounter;
26 window.onload = function() {
27 if (!window.eventSender)
28 debug('Click on the scrollbar. The test passes if nothing is printed.');
29 else {
30 eventSender.mouseMoveTo(select1.offsetLeft + select1.offsetWidth - 2, select1.offsetTop + select1.offsetHeight - 2);
31 eventSender.mouseDown();
32 eventSender.mouseUp();
33 shouldBe('select1.selectedIndex', '-1');
34 shouldBe('changeEventCounter', '0');
36 debug('');
37 debug('Dispatch a change evnet to prepare the next test.');
38 eventSender.mouseMoveTo(select1.offsetLeft + 4, select1.offsetTop + 4);
39 eventSender.mouseDown();
40 eventSender.mouseUp();
41 shouldBe('changeEventCounter', '1');
42 debug('Change the option list size, and click the scrollbar again.');
43 select1.appendChild(new Option("9"));
44 eventSender.mouseMoveTo(select1.offsetLeft + select1.offsetWidth - 2, select1.offsetTop + select1.offsetHeight - 2);
45 eventSender.mouseDown();
46 eventSender.mouseUp();
47 shouldBe('changeEventCounter', '1');
49 finishJSTest();
52 </script>
54 </html>