[iOS] Add test for HTML form validation popover dismissal on tap
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Nov 2016 04:43:08 +0000 (04:43 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Nov 2016 04:43:08 +0000 (04:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165185

Reviewed by Simon Fraser.

Add test for HTML form validation popover dismissal on tap outside the
popover.

* fast/forms/ios/validation-bubble-dismiss-on-tap-expected.txt: Added.
* fast/forms/ios/validation-bubble-dismiss-on-tap.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209119 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/forms/ios/validation-bubble-dismiss-on-tap-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/ios/validation-bubble-dismiss-on-tap.html [new file with mode: 0644]

index 98dd29b..f1d2109 100644 (file)
@@ -1,3 +1,16 @@
+2016-11-29  Chris Dumez  <cdumez@apple.com>
+
+        [iOS] Add test for HTML form validation popover dismissal on tap
+        https://bugs.webkit.org/show_bug.cgi?id=165185
+
+        Reviewed by Simon Fraser.
+
+        Add test for HTML form validation popover dismissal on tap outside the
+        popover.
+
+        * fast/forms/ios/validation-bubble-dismiss-on-tap-expected.txt: Added.
+        * fast/forms/ios/validation-bubble-dismiss-on-tap.html: Added.
+
 2016-11-29  Nan Wang  <n_wang@apple.com>
 
         AX: ARIA tree & treeitem roles & aria-expanded state not spoken to VoiceOver iOS 10
diff --git a/LayoutTests/fast/forms/ios/validation-bubble-dismiss-on-tap-expected.txt b/LayoutTests/fast/forms/ios/validation-bubble-dismiss-on-tap-expected.txt
new file mode 100644 (file)
index 0000000..3ceb9e5
--- /dev/null
@@ -0,0 +1,11 @@
+Tests that tapping the view dismisses the HTML form validation popover.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS validationBubbleContents.message is "Check this box"
+PASS validationBubbleContents.message is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/forms/ios/validation-bubble-dismiss-on-tap.html b/LayoutTests/fast/forms/ios/validation-bubble-dismiss-on-tap.html
new file mode 100644 (file)
index 0000000..5433d8b
--- /dev/null
@@ -0,0 +1,60 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+    <meta name="viewport" content="width=device-width">
+    <script src="../../../resources/js-test-pre.js"></script>
+    <script>
+    jsTestIsAsync = true;
+
+    function getValidationBubbleContents()
+    {
+        return `
+        (function() {
+            return JSON.stringify(uiController.contentsOfUserInterfaceItem('validationBubble'));
+        })();`
+    }
+
+    function getTapAtPointUIScript(x, y)
+    {
+        return `
+            (function() {
+                uiController.singleTapAtPoint(${x}, ${y}, function() {
+                    uiController.uiScriptComplete('');
+                });
+            })();`
+    }
+
+    function doTest()
+    {
+        if (!testRunner.runUIScript)
+            return;
+
+        description("Tests that tapping the view dismisses the HTML form validation popover.");
+
+        document.getElementById("testSubmitButton").click();
+
+        testRunner.runUIScript(getValidationBubbleContents(), function(result) {
+            validationBubbleContents = JSON.parse(result).validationBubble;
+            shouldBeEqualToString("validationBubbleContents.message", "Check this box");
+
+            testRunner.runUIScript(getTapAtPointUIScript(0, 0), function() {
+                testRunner.runUIScript(getValidationBubbleContents(), function(result) {
+                    validationBubbleContents = JSON.parse(result).validationBubble;
+                    shouldBeEqualToString("validationBubbleContents.message", ""); // Not visible.
+                    finishJSTest();
+                });
+            });
+        });
+    }
+
+    window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+<form>
+<input type="checkbox" id="testInput" required><input type="submit" id="testSubmitButton">
+<script src="../../../resources/js-test-post.js"></script>
+</form>
+</body>
+</html>