Title: [286847] trunk/LayoutTests/imported/w3c
Revision
286847
Author
[email protected]
Date
2021-12-10 06:07:23 -0800 (Fri, 10 Dec 2021)

Log Message

[WPT] Import resources/accesskey.js
https://bugs.webkit.org/show_bug.cgi?id=234137

Reviewed by Rob Buis.

This just imports the changes from this WPT PR:
https://github.com/web-platform-tests/wpt/pull/32000

Which will allow to write other WPT tests using pressAccessKey() method.

* web-platform-tests/resources/accesskey.js: Added.
(pressAccessKey):
* web-platform-tests/resources/w3c-import.log:
* web-platform-tests/shadow-dom/accesskey.tentative.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (286846 => 286847)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-10 13:51:02 UTC (rev 286846)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-10 14:07:23 UTC (rev 286847)
@@ -1,3 +1,20 @@
+2021-12-10  Manuel Rego Casasnovas  <[email protected]>
+
+        [WPT] Import resources/accesskey.js
+        https://bugs.webkit.org/show_bug.cgi?id=234137
+
+        Reviewed by Rob Buis.
+
+        This just imports the changes from this WPT PR:
+        https://github.com/web-platform-tests/wpt/pull/32000
+
+        Which will allow to write other WPT tests using pressAccessKey() method.
+
+        * web-platform-tests/resources/accesskey.js: Added.
+        (pressAccessKey):
+        * web-platform-tests/resources/w3c-import.log:
+        * web-platform-tests/shadow-dom/accesskey.tentative.html:
+
 2021-12-09  Chris Dumez  <[email protected]>
 
         Add basic support for launching a SharedWorker

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/resources/accesskey.js (0 => 286847)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resources/accesskey.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resources/accesskey.js	2021-12-10 14:07:23 UTC (rev 286847)
@@ -0,0 +1,34 @@
+/*
+ * Function that sends an accesskey using the proper key combination depending on the browser and OS.
+ *
+ * This needs that the test imports the following scripts:
+ *     <script src=""
+ *     <script src=""
+ *     <script src=""
+*/
+function pressAccessKey(accessKey){
+  let controlKey = '\uE009'; // left Control key
+  let altKey = '\uE00A'; // left Alt key
+  let optionKey = altKey;  // left Option key
+  let shiftKey = '\uE008'; // left Shift key
+  // There are differences in using accesskey across browsers and OS's.
+  // See: // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/accesskey
+  let isMacOSX = navigator.userAgent.indexOf("Mac") != -1;
+  let osAccessKey = isMacOSX ? [controlKey, optionKey] : [shiftKey, altKey];
+  let actions = new test_driver.Actions();
+  // Press keys.
+  for (let key of osAccessKey) {
+    actions = actions.keyDown(key);
+  }
+  actions = actions
+            .keyDown(accessKey)
+            .addTick()
+            .keyUp(accessKey);
+  osAccessKey.reverse();
+  for (let key of osAccessKey) {
+    actions = actions.keyUp(key);
+  }
+  return actions.send();
+}
+
+

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resources/w3c-import.log (286846 => 286847)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resources/w3c-import.log	2021-12-10 13:51:02 UTC (rev 286846)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resources/w3c-import.log	2021-12-10 14:07:23 UTC (rev 286847)
@@ -17,6 +17,7 @@
 /LayoutTests/imported/w3c/web-platform-tests/resources/.htaccess
 /LayoutTests/imported/w3c/web-platform-tests/resources/META.yml
 /LayoutTests/imported/w3c/web-platform-tests/resources/SVGAnimationTestCase-testharness.js
+/LayoutTests/imported/w3c/web-platform-tests/resources/accesskey.js
 /LayoutTests/imported/w3c/web-platform-tests/resources/check-layout-th.js
 /LayoutTests/imported/w3c/web-platform-tests/resources/idlharness.js
 /LayoutTests/imported/w3c/web-platform-tests/resources/idlharness.js.headers

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/accesskey.tentative.html (286846 => 286847)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/accesskey.tentative.html	2021-12-10 13:51:02 UTC (rev 286846)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/accesskey.tentative.html	2021-12-10 14:07:23 UTC (rev 286847)
@@ -8,6 +8,7 @@
 <script src=""
 <script src=""
 <script src=""
+<script src=""
 </head>
 <body>
 <div id="log"></div>
@@ -16,31 +17,6 @@
 
 const container = document.getElementById('container');
 
-function pressAccessKey(accessKey){
-  let controlKey = '\uE009'; // left Control key
-  let altKey = '\uE00A'; // left Alt key
-  let optionKey = altKey;  // left Option key
-  let shiftKey = '\uE008'; // left Shift key
-  // There are differences in using accesskey across browsers and OS's.
-  // See: // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/accesskey
-  let isMacOSX = navigator.userAgent.indexOf("Mac") != -1;
-  let osAccessKey = isMacOSX ? [controlKey, optionKey] : [shiftKey, altKey];
-  let actions = new test_driver.Actions();
-  // Press keys.
-  for (let key of osAccessKey) {
-    actions = actions.keyDown(key);
-  }
-  actions = actions
-            .keyDown(accessKey)
-            .addTick()
-            .keyUp(accessKey);
-  osAccessKey.reverse();
-  for (let key of osAccessKey) {
-    actions = actions.keyUp(key);
-  }
-  return actions.send();
-}
-
 function testAccesskeyInShadowTree(mode) {
   promise_test(async t => {
     const host = document.createElement('div');
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to