Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(848)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/listbox-deselect-scroll.html

Issue 1509853008: Move select/option/optgroup-related tests in fast/forms to fast/forms/select. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description('This tests that deselecting an option won&apos;t cause unnecessary scrolling.');
11
12 function mouseDownOnSelect(selId, index, modifier) {
13 var sl = document.getElementById(selId);
14 var itemHeight = Math.floor(sl.offsetHeight / sl.size);
15 var border = 1;
16 var y = border + index * itemHeight - window.pageYOffset;
17 if (window.eventSender) {
18 eventSender.mouseMoveTo(sl.offsetLeft + border, sl.offsetTop + y);
19 eventSender.mouseDown(0, [modifier]);
20 eventSender.mouseUp(0, [modifier]);
21 }
22 }
23
24 function selectionPattern(select) {
25 var result = '';
26 for (var i = 0; i < select.options.length; i++)
27 result += select.options[i].selected ? '1' : '0';
28 return result;
29 }
30
31 var parent = document.createElement('div');
32 parent.innerHTML = '<select id="sl" multiple="multiple" size="5">'
33 + '<option value="Accessibility">Accessibility</option>'
34 + '<option value="CSS">CSS</option>'
35 + '<option value="Drosera">Drosera</option>'
36 + '<option value="Evangelism">Evangelism</option>'
37 + '<option value="Forms">Forms</option>'
38 + '<option value="Frames">Frames</option>'
39 + '<option value="History">History</option>'
40 + '<option value="HTML DOM">HTML DOM</option>'
41 + '<option value="HTML Editing">HTML Editing</option>'
42 + '<option value="Images">Images</option>'
43 + '<option>SCROLL UP</option>'
44 + '</select>';
45 document.body.appendChild(parent);
46
47 var sl = document.getElementById('sl');
48 sl.focus();
49 document.execCommand("SelectAll");
50 sl.scrollTop = Math.floor(sl.offsetHeight / sl.size) * 4 + 6;
51 var scrollBeforeClick = sl.scrollTop;
52 mouseDownOnSelect("sl", 3, "addSelectionKey");
53 shouldBe('sl.scrollTop', 'scrollBeforeClick');
54 shouldBe('selectionPattern(sl)', '"11111110111"');
55 </script>
56 </body>
57 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698