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

Side by Side Diff: LayoutTests/fast/forms/suggestion-picker/time-suggestion-picker-mouse-operations.html

Issue 618193003: Rename page-popup helper functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months 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 | Annotate | Revision Log
OLDNEW
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="../../forms/resources/common.js"></script> 5 <script src="../../forms/resources/common.js"></script>
6 <script src="../../forms/resources/common-wheel-event.js"></script> 6 <script src="../../forms/resources/common-wheel-event.js"></script>
7 <script src="../../forms/resources/picker-common.js"></script> 7 <script src="../../forms/resources/picker-common.js"></script>
8 <script src="resources/suggestion-picker-common.js"></script> 8 <script src="resources/suggestion-picker-common.js"></script>
9 </head> 9 </head>
10 <body style="background-color: #bbbbbb;"> 10 <body style="background-color: #bbbbbb;">
(...skipping 21 matching lines...) Expand all
32 <option>01:18</option> 32 <option>01:18</option>
33 <option>01:19</option> 33 <option>01:19</option>
34 <option>01:20</option> 34 <option>01:20</option>
35 <option>01:21</option> 35 <option>01:21</option>
36 </datalist> 36 </datalist>
37 <script> 37 <script>
38 debug('Check that page popup doesn\'t exist at first.'); 38 debug('Check that page popup doesn\'t exist at first.');
39 shouldBeNull('$("mock-page-popup")'); 39 shouldBeNull('$("mock-page-popup")');
40 40
41 window.onload = function() { 41 window.onload = function() {
42 openPicker($('time'), test1); 42 openPickerWithMock($('time'), test1);
43 }; 43 };
44 44
45 45
46 function test1() { 46 function test1() {
47 debug('Check that page popup exists.'); 47 debug('Check that page popup exists.');
48 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]'); 48 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]');
49 49
50 debug('Check that page popup exists.'); 50 debug('Check that page popup exists.');
51 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]'); 51 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]');
52 52
53 debug('Check that hovering over an entry highlights it.'); 53 debug('Check that hovering over an entry highlights it.');
54 hoverOverElement(popupWindow.document.querySelector(".suggestion-list-entry: nth-child(2)")); 54 hoverOverElement(popupWindow.document.querySelector(".suggestion-list-entry: nth-child(2)"));
55 shouldBeEqualToString('highlightedEntry()', '01:02'); 55 shouldBeEqualToString('highlightedEntry()', '01:02');
56 56
57 debug('Check that moving the mouse outside the popup de-highlights entries.' ); 57 debug('Check that moving the mouse outside the popup de-highlights entries.' );
58 hoverOverElement(document.getElementById('description')); 58 hoverOverElement(document.getElementById('description'));
59 shouldBeNull('highlightedEntry()'); 59 shouldBeNull('highlightedEntry()');
60 60
61 debug('Check that mouse click closes the popup and sets the value.'); 61 debug('Check that mouse click closes the popup and sets the value.');
62 clickElement(popupWindow.document.querySelector(".suggestion-list-entry:nth- child(3)")); 62 clickElement(popupWindow.document.querySelector(".suggestion-list-entry:nth- child(3)"));
63 waitUntilClosing(test1AfterClosing); 63 waitUntilClosing(test1AfterClosing);
64 } 64 }
65 65
66 function test1AfterClosing() { 66 function test1AfterClosing() {
67 shouldBeNull('document.getElementById("mock-page-popup")'); 67 shouldBeNull('document.getElementById("mock-page-popup")');
68 shouldBeEqualToString('document.getElementById("time").value', '01:03'); 68 shouldBeEqualToString('document.getElementById("time").value', '01:03');
69 69
70 openPicker($('time'), test2); 70 openPickerWithMock($('time'), test2);
71 } 71 }
72 72
73 var scrollTopBeforeWheelEvent = 0; 73 var scrollTopBeforeWheelEvent = 0;
74 var scrollTopAfterWheelEvent = 0; 74 var scrollTopAfterWheelEvent = 0;
75 75
76 function test2() { 76 function test2() {
77 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0]; 77 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0];
78 78
79 debug('Check that you can scroll using the mouse wheel.'); 79 debug('Check that you can scroll using the mouse wheel.');
80 80
81 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 81 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
82 dispatchWheelEvent(suggestionList, 0, -100); 82 dispatchWheelEvent(suggestionList, 0, -100);
83 scrollTopAfterWheelEvent = suggestionList.scrollTop; 83 scrollTopAfterWheelEvent = suggestionList.scrollTop;
84 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); 84 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent');
85 85
86 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 86 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
87 dispatchWheelEvent(suggestionList, 0, 100); 87 dispatchWheelEvent(suggestionList, 0, 100);
88 scrollTopAfterWheelEvent = suggestionList.scrollTop; 88 scrollTopAfterWheelEvent = suggestionList.scrollTop;
89 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent'); 89 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent');
90 90
91 popupWindow.focus(); 91 popupWindow.focus();
92 eventSender.keyDown('escape'); 92 eventSender.keyDown('escape');
93 waitUntilClosing(test2AfterClosing); 93 waitUntilClosing(test2AfterClosing);
94 } 94 }
95 95
96 function test2AfterClosing() { 96 function test2AfterClosing() {
97 shouldBeNull('$("mock-page-popup")'); 97 shouldBeNull('$("mock-page-popup")');
98 98
99 openPicker($('time'), test3); 99 openPickerWithMock($('time'), test3);
100 } 100 }
101 101
102 function test3() { 102 function test3() {
103 debug('Check that you can scroll using the scroll bar.'); 103 debug('Check that you can scroll using the scroll bar.');
104 104
105 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0]; 105 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0];
106 var suggestionListOffset = cumulativeOffset(suggestionList); 106 var suggestionListOffset = cumulativeOffset(suggestionList);
107 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2; 107 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2;
108 108
109 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 109 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
110 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels 110 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels
111 eventSender.mouseDown(); 111 eventSender.mouseDown();
112 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight); 112 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight);
113 eventSender.mouseUp(); 113 eventSender.mouseUp();
114 scrollTopAfterWheelEvent = suggestionList.scrollTop; 114 scrollTopAfterWheelEvent = suggestionList.scrollTop;
115 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); 115 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent');
116 116
117 finishJSTest(); 117 finishJSTest();
118 } 118 }
119 119
120 </script> 120 </script>
121 </body> 121 </body>
122 </html> 122 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698