Title: [129106] trunk
Revision
129106
Author
[email protected]
Date
2012-09-20 01:35:20 -0700 (Thu, 20 Sep 2012)

Log Message

REGRESSION(r127727): Can't navigate between months with arrow keys in calendar picker
https://bugs.webkit.org/show_bug.cgi?id=97166

Reviewed by Kent Tamura.

Source/WebCore:

Fixing bug in r127727 so arrow keys work properly.

Test: fast/forms/date/calendar-picker-key-operations.html

* Resources/pagepopups/calendarPicker.js:
(DaysTable.prototype._maybeSetPreviousMonth):
(DaysTable.prototype._maybeSetNextMonth):

LayoutTests:

* fast/forms/date/calendar-picker-key-operations-expected.txt: Added.
* fast/forms/date/calendar-picker-key-operations.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (129105 => 129106)


--- trunk/LayoutTests/ChangeLog	2012-09-20 08:33:46 UTC (rev 129105)
+++ trunk/LayoutTests/ChangeLog	2012-09-20 08:35:20 UTC (rev 129106)
@@ -1,3 +1,13 @@
+2012-09-20  Keishi Hattori  <[email protected]>
+
+        REGRESSION(r127727): Can't navigate between months with arrow keys in calendar picker
+        https://bugs.webkit.org/show_bug.cgi?id=97166
+
+        Reviewed by Kent Tamura.
+
+        * fast/forms/date/calendar-picker-key-operations-expected.txt: Added.
+        * fast/forms/date/calendar-picker-key-operations.html: Added.
+
 2012-09-20  Mikhail Pozdnyakov  <[email protected]>
 
         [EFL] Rebaseline after r129050

Added: trunk/LayoutTests/fast/forms/date/calendar-picker-key-operations-expected.txt (0 => 129106)


--- trunk/LayoutTests/fast/forms/date/calendar-picker-key-operations-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/date/calendar-picker-key-operations-expected.txt	2012-09-20 08:35:20 UTC (rev 129106)
@@ -0,0 +1,30 @@
+Tests if calendar picker key bindings work as expected.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Check that page popup doesn't exist at first.
+PASS document.getElementById("mock-page-popup") is null
+Check that page popup exists.
+PASS pickerWindow.pagePopupController.toString() is "[object PagePopupController]"
+PASS selectedDate() is "2000-01-02"
+PASS selectedMonthYear() is "2000-0"
+Check that arrow keys work properly even when going between weeks and months.
+PASS selectedDate() is "1999-12-26"
+PASS selectedMonthYear() is "2000-0"
+PASS selectedDate() is "2000-01-02"
+PASS selectedMonthYear() is "1999-11"
+PASS selectedDate() is "1999-12-26"
+PASS selectedMonthYear() is "2000-0"
+PASS selectedDate() is "2000-01-02"
+PASS selectedMonthYear() is "2000-0"
+PASS selectedDate() is "1999-12-26"
+PASS selectedMonthYear() is "2000-0"
+PASS selectedDate() is "2000-01-08"
+PASS selectedMonthYear() is "1999-11"
+PASS selectedDate() is "1999-12-26"
+PASS selectedMonthYear() is "2000-0"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+ 

Added: trunk/LayoutTests/fast/forms/date/calendar-picker-key-operations.html (0 => 129106)


--- trunk/LayoutTests/fast/forms/date/calendar-picker-key-operations.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/date/calendar-picker-key-operations.html	2012-09-20 08:35:20 UTC (rev 129106)
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<input type=date id=date value="2000-01-02">
+<script>
+description("Tests if calendar picker key bindings work as expected.");
+window.jsTestIsAsync = true;
+if (window.internals)
+    internals.settings.setEnableMockPagePopup(true);
+
+debug('Check that page popup doesn\'t exist at first.');
+shouldBeNull('document.getElementById("mock-page-popup")');
+
+sendKey(document.getElementById('date'), 'Down');
+
+var pickerWindow = document.getElementById('mock-page-popup').contentWindow;
+pickerWindow.addEventListener("resize", function() {
+    debug('Check that page popup exists.');
+    shouldBe('pickerWindow.pagePopupController.toString()', '"[object PagePopupController]"');
+
+    shouldBe('selectedDate()', '"2000-01-02"');
+    shouldBe('selectedMonthYear()', '"2000-0"');
+
+    debug('Check that arrow keys work properly even when going between weeks and months.');
+
+    eventSender.keyDown('upArrow');
+    shouldBe('selectedDate()', '"1999-12-26"');
+    shouldBe('selectedMonthYear()', '"2000-0"');
+    // Move from first row of January 2000 to last row of December 1999.
+    eventSender.keyDown('upArrow');
+    shouldBe('selectedDate()', '"2000-01-02"');
+    shouldBe('selectedMonthYear()', '"1999-11"');
+    
+    eventSender.keyDown('downArrow');
+    shouldBe('selectedDate()', '"1999-12-26"');
+    shouldBe('selectedMonthYear()', '"2000-0"');
+    eventSender.keyDown('downArrow');
+    shouldBe('selectedDate()', '"2000-01-02"');
+    shouldBe('selectedMonthYear()', '"2000-0"');
+
+    eventSender.keyDown('upArrow');
+    shouldBe('selectedDate()', '"1999-12-26"');
+    shouldBe('selectedMonthYear()', '"2000-0"');
+
+    // Move from top left of January 2000 to bottom right of December 1999.
+    eventSender.keyDown('leftArrow');
+    shouldBe('selectedDate()', '"2000-01-08"');
+    shouldBe('selectedMonthYear()', '"1999-11"');
+
+    eventSender.keyDown('rightArrow');
+    shouldBe('selectedDate()', '"1999-12-26"');
+    shouldBe('selectedMonthYear()', '"2000-0"');
+
+    finishJSTest();
+}, false);
+
+function selectedDate() {
+    var element = pickerWindow.document.querySelector(".day-selected");
+    if (!element)
+        return null;
+    return element.dataset.submitValue;
+}
+
+function selectedMonthYear() {
+    var element = pickerWindow.document.querySelector(".selected-month-year");
+    if (!element)
+        return null;
+    return element.dataset.value;
+}
+
+function sendKey(input, keyName) {
+    var event = document.createEvent('KeyboardEvent');
+    event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName);
+    input.dispatchEvent(event);
+}
+</script>
+<script src=""
+</body>
+

Modified: trunk/Source/WebCore/ChangeLog (129105 => 129106)


--- trunk/Source/WebCore/ChangeLog	2012-09-20 08:33:46 UTC (rev 129105)
+++ trunk/Source/WebCore/ChangeLog	2012-09-20 08:35:20 UTC (rev 129106)
@@ -1,3 +1,18 @@
+2012-09-20  Keishi Hattori  <[email protected]>
+
+        REGRESSION(r127727): Can't navigate between months with arrow keys in calendar picker
+        https://bugs.webkit.org/show_bug.cgi?id=97166
+
+        Reviewed by Kent Tamura.
+
+        Fixing bug in r127727 so arrow keys work properly.
+
+        Test: fast/forms/date/calendar-picker-key-operations.html
+
+        * Resources/pagepopups/calendarPicker.js:
+        (DaysTable.prototype._maybeSetPreviousMonth):
+        (DaysTable.prototype._maybeSetNextMonth):
+
 2012-09-18  Alexander Pavlov  <[email protected]>
 
         Web Inspector: Use and process the actual ScriptId in the protocol EventListener object

Modified: trunk/Source/WebCore/Resources/pagepopups/calendarPicker.js (129105 => 129106)


--- trunk/Source/WebCore/Resources/pagepopups/calendarPicker.js	2012-09-20 08:33:46 UTC (rev 129105)
+++ trunk/Source/WebCore/Resources/pagepopups/calendarPicker.js	2012-09-20 08:35:20 UTC (rev 129106)
@@ -985,10 +985,10 @@
  * @return {!boolean}
  */
 DaysTable.prototype._maybeSetPreviousMonth = function() {
-    var year = global.yearMonthController.year();
-    var month = global.yearMonthController.month();
+    var year = this.picker.yearMonthController.year();
+    var month = this.picker.yearMonthController.month();
     var thisMonthStartTime = createUTCDate(year, month, 1).getTime();
-    if (this.minimumDate.getTime() >= thisMonthStartTime)
+    if (this.picker.minimumDate.getTime() >= thisMonthStartTime)
         return false;
     if (month == 0) {
         year--;
@@ -1003,8 +1003,8 @@
  * @return {!boolean}
  */
 DaysTable.prototype._maybeSetNextMonth = function() {
-    var year = global.yearMonthController.year();
-    var month = global.yearMonthController.month();
+    var year = this.picker.yearMonthController.year();
+    var month = this.picker.yearMonthController.month();
     if (month == 11) {
         year++;
         month = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to