Title: [252608] trunk/LayoutTests
Revision
252608
Author
[email protected]
Date
2019-11-18 17:05:14 -0800 (Mon, 18 Nov 2019)

Log Message

Update dismiss-picker-using-keyboard.html test to work on iPad correctly
https://bugs.webkit.org/show_bug.cgi?id=204257
<rdar://problem/57239690>

Reviewed by Wenson Hsieh.

The iPad does not use the keyboard to show the options for these form controls,
and instead uses a popover. This expands the test infrastructure to allow for
either iPhone or iPad functionality.

* fast/forms/ios/dismiss-picker-using-keyboard.html:
* resources/ui-helper.js:
(window.UIHelper.activateAndWaitForInputSessionAt.return.new.Promise.):
(window.UIHelper.waitForInputSessionToDismiss.return.new.Promise.):
(window.UIHelper.waitForInputSessionToDismiss.return.new.Promise):
(window.UIHelper.waitForInputSessionToDismiss):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (252607 => 252608)


--- trunk/LayoutTests/ChangeLog	2019-11-19 00:54:57 UTC (rev 252607)
+++ trunk/LayoutTests/ChangeLog	2019-11-19 01:05:14 UTC (rev 252608)
@@ -1,3 +1,22 @@
+2019-11-18  Megan Gardner  <[email protected]>
+
+        Update dismiss-picker-using-keyboard.html test to work on iPad correctly
+        https://bugs.webkit.org/show_bug.cgi?id=204257
+        <rdar://problem/57239690>
+
+        Reviewed by Wenson Hsieh.
+
+        The iPad does not use the keyboard to show the options for these form controls,
+        and instead uses a popover. This expands the test infrastructure to allow for
+        either iPhone or iPad functionality.
+
+        * fast/forms/ios/dismiss-picker-using-keyboard.html:
+        * resources/ui-helper.js:
+        (window.UIHelper.activateAndWaitForInputSessionAt.return.new.Promise.):
+        (window.UIHelper.waitForInputSessionToDismiss.return.new.Promise.):
+        (window.UIHelper.waitForInputSessionToDismiss.return.new.Promise):
+        (window.UIHelper.waitForInputSessionToDismiss):
+
 2019-11-18  Said Abou-Hallawa  <[email protected]>
 
         Fix getTotalLength() and getPointAtLength() for optimized rect and ellipse renderers

Modified: trunk/LayoutTests/fast/forms/ios/dismiss-picker-using-keyboard.html (252607 => 252608)


--- trunk/LayoutTests/fast/forms/ios/dismiss-picker-using-keyboard.html	2019-11-19 00:54:57 UTC (rev 252607)
+++ trunk/LayoutTests/fast/forms/ios/dismiss-picker-using-keyboard.html	2019-11-19 01:05:14 UTC (rev 252608)
@@ -70,7 +70,7 @@
             let expectedValue = elementToTest.value;
             await UIHelper.activateElementAndWaitForInputSession(elementToTest);
             UIHelper.keyDown(keyCommand.key, keyCommand.modifiers);
-            await UIHelper.waitForKeyboardToHide();
+            await UIHelper.waitForInputSessionToDismiss();
             shouldBeEqualToString("elementToTest.value", expectedValue);
         }
     }

Modified: trunk/LayoutTests/resources/ui-helper.js (252607 => 252608)


--- trunk/LayoutTests/resources/ui-helper.js	2019-11-19 00:54:57 UTC (rev 252607)
+++ trunk/LayoutTests/resources/ui-helper.js	2019-11-19 01:05:14 UTC (rev 252608)
@@ -354,14 +354,34 @@
         return new Promise(resolve => {
             testRunner.runUIScript(`
                 (function() {
-                    uiController.didShowKeyboardCallback = function() {
+                    function clearCallbacksAndScriptComplete() {
+                        uiController.didShowKeyboardCallback = null;
+                        uiController.willPresentPopoverCallback = null;
                         uiController.uiScriptComplete();
-                    };
+                    }
+                    uiController.didShowKeyboardCallback = clearCallbacksAndScriptComplete;
+                    uiController.willPresentPopoverCallback = clearCallbacksAndScriptComplete;
                     uiController.singleTapAtPoint(${x}, ${y}, function() { });
                 })()`, resolve);
         });
     }
 
+    static waitForInputSessionToDismiss()
+    {
+        return new Promise(resolve => {
+            testRunner.runUIScript(`
+                (function() {
+                    function clearCallbacksAndScriptComplete() {
+                        uiController.didHideKeyboardCallback = null;
+                        uiController.didDismissPopoverCallback = null;
+                        uiController.uiScriptComplete();
+                    }
+                    uiController.didHideKeyboardCallback = clearCallbacksAndScriptComplete;
+                    uiController.didDismissPopoverCallback = clearCallbacksAndScriptComplete;
+                })()`, resolve);
+        });
+    }
+
     static activateElementAndWaitForInputSession(element)
     {
         const x = element.offsetLeft + element.offsetWidth / 2;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to