Import a couple of Chromium accesskey tests.
authorjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Sep 2015 20:54:31 +0000 (20:54 +0000)
committerjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Sep 2015 20:54:31 +0000 (20:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148865

Reviewed by Daniel Bates.

* fast/forms/access-key-case-insensitive-expected.txt: Added.
* fast/forms/access-key-case-insensitive.html: Added.
* fast/forms/access-key-mutated-expected.txt: Added.
* fast/forms/access-key-mutated.html: Added.
* platform/ios-simulator/TestExpectations:
These tests are asynchronous and use unsupported features; skip them on
iOS so they don't time out.

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/access-key-case-insensitive-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/access-key-case-insensitive.html [new file with mode: 0644]
LayoutTests/fast/forms/access-key-mutated-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/access-key-mutated.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator/TestExpectations

index de400d8..bcf5e50 100644 (file)
@@ -1,3 +1,18 @@
+2015-09-04  Jon Honeycutt  <jhoneycutt@apple.com>
+
+        Import a couple of Chromium accesskey tests.
+        https://bugs.webkit.org/show_bug.cgi?id=148865
+
+        Reviewed by Daniel Bates.
+
+        * fast/forms/access-key-case-insensitive-expected.txt: Added.
+        * fast/forms/access-key-case-insensitive.html: Added.
+        * fast/forms/access-key-mutated-expected.txt: Added.
+        * fast/forms/access-key-mutated.html: Added.
+        * platform/ios-simulator/TestExpectations:
+        These tests are asynchronous and use unsupported features; skip them on
+        iOS so they don't time out.
+
 2015-09-05  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, skip http/tests/w3c/html/semantics/embedded-content/media-elements/* tests on Win/Debug.
diff --git a/LayoutTests/fast/forms/access-key-case-insensitive-expected.txt b/LayoutTests/fast/forms/access-key-case-insensitive-expected.txt
new file mode 100644 (file)
index 0000000..6598fcd
--- /dev/null
@@ -0,0 +1,12 @@
+Access key should work case-insensitively. To test this manually, press <alt>+a, <alt>+<shift>+b and <alt>+<shift>+c keys in this order (on Mac OS X, press <ctrl>+<opt> instead of <alt>).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Pressing the "a" access key triggered a focus event.
+PASS Pressing the "B" access key triggered a focus event.
+PASS Pressing the "C" access key triggered a focus event.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/forms/access-key-case-insensitive.html b/LayoutTests/fast/forms/access-key-case-insensitive.html
new file mode 100644 (file)
index 0000000..f4cbb71
--- /dev/null
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Case insensitiveness of accesskey attribute</title>
+<script src="../../resources/js-test.js"></script>
+</head>
+</head>
+<body>
+<script>
+description('Access key should work case-insensitively. To test this manually, press &lt;alt&gt;+a, &lt;alt&gt;+&lt;shift&gt;+b and &lt;alt&gt;+&lt;shift&gt;+c keys in this order (on Mac OS X, press &lt;ctrl&gt;+&lt;opt&gt; instead of &lt;alt&gt;).');
+
+window.jsTestIsAsync = true;
+
+function isUpperCase(string)
+{
+    return string === string.toUpperCase();
+}
+
+function pressKey(key)
+{
+    var modifiers;
+    if (navigator.userAgent.search(/\bMac OS X\b/) !== -1)
+        modifiers = ["ctrlKey", "altKey"];
+    else
+        modifiers = ["altKey"];
+
+    if (isUpperCase(key)) {
+        modifiers.push("shiftKey");
+        key = key.toLowerCase();
+    }
+
+    if (window.eventSender)
+        eventSender.keyDown(key, modifiers);
+}
+
+document.addEventListener("DOMContentLoaded", function () {
+    var input = document.createElement('input');
+    input.accessKey = 'A';
+    input.onfocus = function () {
+        testPassed('Pressing the "a" access key triggered a focus event.');
+        input.blur();
+        input.accessKey = 'b';
+        input.onfocus = function () {
+            testPassed('Pressing the "B" access key triggered a focus event.');
+            input.blur();
+            input.setAttribute('accesskey', 'C');
+            input.onfocus = function () {
+                testPassed('Pressing the "C" access key triggered a focus event.');
+                document.body.removeChild(input);
+                finishJSTest();
+            };
+            pressKey('C');
+        };
+        pressKey('B');
+    };
+    document.body.appendChild(input);
+    pressKey('a');
+});
+</script>
+</body>
+</html>
diff --git a/LayoutTests/fast/forms/access-key-mutated-expected.txt b/LayoutTests/fast/forms/access-key-mutated-expected.txt
new file mode 100644 (file)
index 0000000..a617bcf
--- /dev/null
@@ -0,0 +1,12 @@
+Access key should work after accesskey attribute is mutated. To test this manually, press <alt>+a, <alt>+b and <alt>+c keys in this order (on Mac OS X, press <Ctrl>+<Opt> instead of <alt>).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Pressing the "a" access key triggered a focus event.
+PASS Pressing the "b" access key triggered a focus event.
+PASS Pressing the "c" access key triggered a focus event.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/forms/access-key-mutated.html b/LayoutTests/fast/forms/access-key-mutated.html
new file mode 100644 (file)
index 0000000..de65ffa
--- /dev/null
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Mutating accesskey attribute</title>
+<script src="../../resources/js-test.js"></script>
+</head>
+</head>
+<body>
+<script>
+description('Access key should work after accesskey attribute is mutated. To test this manually, press &lt;alt&gt;+a, &lt;alt&gt;+b and &lt;alt&gt;+c keys in this order (on Mac OS X, press &lt;Ctrl&gt;+&lt;Opt&gt; instead of &lt;alt&gt;).');
+
+window.jsTestIsAsync = true;
+
+function pressKey(key)
+{
+    if (navigator.userAgent.search(/\bMac OS X\b/) !== -1)
+        modifiers = ["ctrlKey", "altKey"];
+    else
+        modifiers = ["altKey"];
+
+    if (window.eventSender)
+        eventSender.keyDown(key, modifiers);
+}
+
+document.addEventListener("DOMContentLoaded", function () {
+    var input = document.createElement('input');
+    input.accessKey = 'a';
+    input.onfocus = function () {
+        testPassed('Pressing the "a" access key triggered a focus event.');
+        input.blur();
+        input.accessKey = 'b';
+        input.onfocus = function () {
+            testPassed('Pressing the "b" access key triggered a focus event.');
+            input.blur();
+            input.setAttribute('accesskey', 'c');
+            input.onfocus = function () {
+                testPassed('Pressing the "c" access key triggered a focus event.');
+                document.body.removeChild(input);
+                finishJSTest();
+            };
+            pressKey('c');
+        };
+        pressKey('b');
+    };
+    document.body.appendChild(input);
+    pressKey('a');
+});
+</script>
+</body>
+</html>
index f413321..d9e6ef3 100644 (file)
@@ -2412,6 +2412,8 @@ fast/forms/file/input-file-directory-upload.html
 fast/forms/file/input-file-re-render.html
 fast/forms/file/recover-file-input-in-unposted-form.html
 fast/forms/file/selected-files-from-history-state.html
+fast/forms/access-key-case-insensitive.html
+fast/forms/access-key-mutated.html
 fast/forms/interactive-validation-attach-assertion.html
 fast/forms/search-event-delay.html
 fast/forms/select/listbox-oninput-fired.html