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

Side by Side Diff: LayoutTests/fast/forms/suggestion-picker/month-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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 <option>2015-11</option> 61 <option>2015-11</option>
62 <option>2015-12</option> 62 <option>2015-12</option>
63 <option>2012-00</option> <!--invalid--> 63 <option>2012-00</option> <!--invalid-->
64 <option>2012-01-01</option> <!--invalid--> 64 <option>2012-01-01</option> <!--invalid-->
65 <option>foo</option> <!--invalid--> 65 <option>foo</option> <!--invalid-->
66 </datalist> 66 </datalist>
67 <script> 67 <script>
68 debug('Check that page popup doesn\'t exist at first.'); 68 debug('Check that page popup doesn\'t exist at first.');
69 shouldBeNull('$("mock-page-popup")'); 69 shouldBeNull('$("mock-page-popup")');
70 70
71 openPicker($('month'), test1); 71 openPickerWithMock($('month'), test1);
72 72
73 function test1() { 73 function test1() {
74 debug('Check that page popup exists.'); 74 debug('Check that page popup exists.');
75 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]'); 75 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]');
76 76
77 debug('Check that hovering over an entry highlights it.'); 77 debug('Check that hovering over an entry highlights it.');
78 hoverOverElement(popupWindow.document.querySelector(".suggestion-list-entry: nth-child(2)")); 78 hoverOverElement(popupWindow.document.querySelector(".suggestion-list-entry: nth-child(2)"));
79 shouldBeEqualToString('highlightedEntry()', '2012-02'); 79 shouldBeEqualToString('highlightedEntry()', '2012-02');
80 80
81 debug('Check that moving the mouse outside the popup de-highlights entries.' ); 81 debug('Check that moving the mouse outside the popup de-highlights entries.' );
82 hoverOverElement(document.getElementById('description')); 82 hoverOverElement(document.getElementById('description'));
83 shouldBeNull('highlightedEntry()'); 83 shouldBeNull('highlightedEntry()');
84 84
85 debug('Check that mouse click closes the popup and sets the value.'); 85 debug('Check that mouse click closes the popup and sets the value.');
86 clickElement(popupWindow.document.querySelector(".suggestion-list-entry:nth- child(3)")); 86 clickElement(popupWindow.document.querySelector(".suggestion-list-entry:nth- child(3)"));
87 waitUntilClosing(test1AfterClosing); 87 waitUntilClosing(test1AfterClosing);
88 } 88 }
89 89
90 function test1AfterClosing() { 90 function test1AfterClosing() {
91 shouldBeNull('$("mock-page-popup")'); 91 shouldBeNull('$("mock-page-popup")');
92 shouldBeEqualToString('document.getElementById("month").value', '2012-03'); 92 shouldBeEqualToString('document.getElementById("month").value', '2012-03');
93 93
94 openPicker($('month'), test2); 94 openPickerWithMock($('month'), test2);
95 } 95 }
96 96
97 var scrollTopBeforeWheelEvent = 0; 97 var scrollTopBeforeWheelEvent = 0;
98 var scrollTopAfterWheelEvent = 0; 98 var scrollTopAfterWheelEvent = 0;
99 99
100 function test2() { 100 function test2() {
101 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0]; 101 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0];
102 102
103 debug('Check that you can scroll using the mouse wheel.'); 103 debug('Check that you can scroll using the mouse wheel.');
104 104
105 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 105 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
106 dispatchWheelEvent(suggestionList, 0, -100); 106 dispatchWheelEvent(suggestionList, 0, -100);
107 scrollTopAfterWheelEvent = suggestionList.scrollTop; 107 scrollTopAfterWheelEvent = suggestionList.scrollTop;
108 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); 108 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent');
109 109
110 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 110 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
111 dispatchWheelEvent(suggestionList, 0, 100); 111 dispatchWheelEvent(suggestionList, 0, 100);
112 scrollTopAfterWheelEvent = suggestionList.scrollTop; 112 scrollTopAfterWheelEvent = suggestionList.scrollTop;
113 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent'); 113 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent');
114 114
115 popupWindow.focus(); 115 popupWindow.focus();
116 eventSender.keyDown('escape'); 116 eventSender.keyDown('escape');
117 waitUntilClosing(test2AfterClosing); 117 waitUntilClosing(test2AfterClosing);
118 } 118 }
119 119
120 function test2AfterClosing() { 120 function test2AfterClosing() {
121 shouldBeNull('$("mock-page-popup")'); 121 shouldBeNull('$("mock-page-popup")');
122 122
123 openPicker($('month'), test3); 123 openPickerWithMock($('month'), test3);
124 } 124 }
125 125
126 function test3() { 126 function test3() {
127 debug('Check that you can scroll using the scroll bar.'); 127 debug('Check that you can scroll using the scroll bar.');
128 128
129 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0]; 129 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0];
130 var suggestionListOffset = cumulativeOffset(suggestionList); 130 var suggestionListOffset = cumulativeOffset(suggestionList);
131 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2; 131 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2;
132 132
133 scrollTopBeforeWheelEvent = suggestionList.scrollTop; 133 scrollTopBeforeWheelEvent = suggestionList.scrollTop;
134 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels 134 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels
135 eventSender.mouseDown(); 135 eventSender.mouseDown();
136 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight); 136 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight);
137 eventSender.mouseUp(); 137 eventSender.mouseUp();
138 scrollTopAfterWheelEvent = suggestionList.scrollTop; 138 scrollTopAfterWheelEvent = suggestionList.scrollTop;
139 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); 139 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent');
140 140
141 finishJSTest(); 141 finishJSTest();
142 } 142 }
143 143
144 </script> 144 </script>
145 </body> 145 </body>
146 </html> 146 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698