From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../focus/DocumentOrShadowRoot-activeElement.html | 92 ++++++ .../focus/ShadowRoot-delegatesFocus.html | 27 ++ .../focus/blur-on-shadow-host-delegatesFocus.html | 38 +++ .../focus/click-focus-delegatesFocus-click.html | 138 +++++++++ ...click-focus-delegatesFocus-tabindex-varies.html | 68 +++++ .../click-focus-delegatesFocus-tabindex-zero.html | 68 +++++ .../focus/delegatesFocus-tabindex-change.html | 23 ++ .../tests/shadow-dom/focus/focus-autofocus.html | 338 +++++++++++++++++++++ .../focus/focus-click-on-shadow-host.html | 40 +++ ...hod-delegatesFocus-nested-browsing-context.html | 36 +++ .../focus/focus-method-delegatesFocus.html | 312 +++++++++++++++++++ .../focus/focus-method-with-delegatesFocus.html | 101 ++++++ .../focus/focus-pseudo-matches-on-shadow-host.html | 122 ++++++++ .../focus/focus-pseudo-on-shadow-host-1.html | 25 ++ .../focus/focus-pseudo-on-shadow-host-2.html | 27 ++ .../focus/focus-pseudo-on-shadow-host-3.html | 26 ++ .../focus/focus-selector-delegatesFocus.html | 92 ++++++ .../focus/focus-shadowhost-display-none.html | 68 +++++ .../shadow-dom/focus/focus-tab-on-shadow-host.html | 31 ++ ...index-order-shadow-negative-delegatesFocus.html | 34 +++ .../focus-tabindex-order-shadow-negative.html | 34 +++ .../focus-tabindex-order-shadow-slot-one.html | 37 +++ ...bindex-order-shadow-varying-delegatesFocus.html | 36 +++ ...s-tabindex-order-shadow-varying-tabindex-2.html | 66 ++++ ...s-tabindex-order-shadow-varying-tabindex-3.html | 80 +++++ ...cus-tabindex-order-shadow-varying-tabindex.html | 36 +++ ...-tabindex-order-shadow-zero-delegatesFocus.html | 34 +++ ...s-tabindex-order-shadow-zero-host-negative.html | 35 +++ ...-order-shadow-zero-host-not-set-scrollable.html | 38 +++ ...us-tabindex-order-shadow-zero-host-not-set.html | 37 +++ .../focus-tabindex-order-shadow-zero-host-one.html | 37 +++ ...tabindex-order-shadow-zero-host-scrollable.html | 36 +++ .../focus/focus-tabindex-order-shadow-zero.html | 35 +++ .../shadow-dom/focus/resources/shadow-utils.js | 80 +++++ 34 files changed, 2327 insertions(+) create mode 100644 testing/web-platform/tests/shadow-dom/focus/DocumentOrShadowRoot-activeElement.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/ShadowRoot-delegatesFocus.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/blur-on-shadow-host-delegatesFocus.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/click-focus-delegatesFocus-click.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/click-focus-delegatesFocus-tabindex-varies.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/click-focus-delegatesFocus-tabindex-zero.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/delegatesFocus-tabindex-change.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-autofocus.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-click-on-shadow-host.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-method-delegatesFocus-nested-browsing-context.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-method-delegatesFocus.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-method-with-delegatesFocus.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-pseudo-matches-on-shadow-host.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-selector-delegatesFocus.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-shadowhost-display-none.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tab-on-shadow-host.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-negative-delegatesFocus.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-negative.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-slot-one.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-delegatesFocus.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-2.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-3.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-delegatesFocus.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-negative.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set-scrollable.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-one.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-scrollable.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero.html create mode 100644 testing/web-platform/tests/shadow-dom/focus/resources/shadow-utils.js (limited to 'testing/web-platform/tests/shadow-dom/focus') diff --git a/testing/web-platform/tests/shadow-dom/focus/DocumentOrShadowRoot-activeElement.html b/testing/web-platform/tests/shadow-dom/focus/DocumentOrShadowRoot-activeElement.html new file mode 100644 index 0000000000..20456b057e --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/DocumentOrShadowRoot-activeElement.html @@ -0,0 +1,92 @@ + + +HTML Test: DocumentOrShadowRoot.activeElement + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/ShadowRoot-delegatesFocus.html b/testing/web-platform/tests/shadow-dom/focus/ShadowRoot-delegatesFocus.html new file mode 100644 index 0000000000..4b7fe4e50e --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/ShadowRoot-delegatesFocus.html @@ -0,0 +1,27 @@ + + +ShadowRoot's delegatesFocus attribute + + +
+
+
+ diff --git a/testing/web-platform/tests/shadow-dom/focus/blur-on-shadow-host-delegatesFocus.html b/testing/web-platform/tests/shadow-dom/focus/blur-on-shadow-host-delegatesFocus.html new file mode 100644 index 0000000000..289b554372 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/blur-on-shadow-host-delegatesFocus.html @@ -0,0 +1,38 @@ + + +HTML Test: Blur on shadow host + + + + + +
+ +
+ + diff --git a/testing/web-platform/tests/shadow-dom/focus/click-focus-delegatesFocus-click.html b/testing/web-platform/tests/shadow-dom/focus/click-focus-delegatesFocus-click.html new file mode 100644 index 0000000000..0578c15582 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/click-focus-delegatesFocus-click.html @@ -0,0 +1,138 @@ + + +HTML Test: click on shadow host with delegatesFocus + + + + + + + +
+
slotted
+
+
outside
+ + + diff --git a/testing/web-platform/tests/shadow-dom/focus/click-focus-delegatesFocus-tabindex-varies.html b/testing/web-platform/tests/shadow-dom/focus/click-focus-delegatesFocus-tabindex-varies.html new file mode 100644 index 0000000000..4051db128a --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/click-focus-delegatesFocus-tabindex-varies.html @@ -0,0 +1,68 @@ + + +HTML Test: click on shadow host with delegatesFocus + + + + + + + +
+
slotted
+
+
outside
+ + + diff --git a/testing/web-platform/tests/shadow-dom/focus/click-focus-delegatesFocus-tabindex-zero.html b/testing/web-platform/tests/shadow-dom/focus/click-focus-delegatesFocus-tabindex-zero.html new file mode 100644 index 0000000000..5f7914f2a4 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/click-focus-delegatesFocus-tabindex-zero.html @@ -0,0 +1,68 @@ + + +HTML Test: click on shadow host with delegatesFocus + + + + + + + +
+
slotted
+
+
outside
+ + + diff --git a/testing/web-platform/tests/shadow-dom/focus/delegatesFocus-tabindex-change.html b/testing/web-platform/tests/shadow-dom/focus/delegatesFocus-tabindex-change.html new file mode 100644 index 0000000000..f159c22164 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/delegatesFocus-tabindex-change.html @@ -0,0 +1,23 @@ + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-autofocus.html b/testing/web-platform/tests/shadow-dom/focus/focus-autofocus.html new file mode 100644 index 0000000000..75a50b84c6 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-autofocus.html @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-click-on-shadow-host.html b/testing/web-platform/tests/shadow-dom/focus/focus-click-on-shadow-host.html new file mode 100644 index 0000000000..7a318a0200 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-click-on-shadow-host.html @@ -0,0 +1,40 @@ + + +HTML Test: click on shadow host with delegatesFocus + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-method-delegatesFocus-nested-browsing-context.html b/testing/web-platform/tests/shadow-dom/focus/focus-method-delegatesFocus-nested-browsing-context.html new file mode 100644 index 0000000000..d2724f17d5 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-method-delegatesFocus-nested-browsing-context.html @@ -0,0 +1,36 @@ + + +HTML Test: focus() on shadow host within an iframe with delegatesFocus + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-method-delegatesFocus.html b/testing/web-platform/tests/shadow-dom/focus/focus-method-delegatesFocus.html new file mode 100644 index 0000000000..99667029ad --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-method-delegatesFocus.html @@ -0,0 +1,312 @@ + + +HTML Test: focus() on shadow host with delegatesFocus + + + + + + + +
+
slottedToSecondSlot
+
slottedToFirstSlot
+
+
outside
+ + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-method-with-delegatesFocus.html b/testing/web-platform/tests/shadow-dom/focus/focus-method-with-delegatesFocus.html new file mode 100644 index 0000000000..8caea8ccda --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-method-with-delegatesFocus.html @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-pseudo-matches-on-shadow-host.html b/testing/web-platform/tests/shadow-dom/focus/focus-pseudo-matches-on-shadow-host.html new file mode 100644 index 0000000000..34f8c01294 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-pseudo-matches-on-shadow-host.html @@ -0,0 +1,122 @@ + + + + + + + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1.html b/testing/web-platform/tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1.html new file mode 100644 index 0000000000..ba900d6a6d --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-pseudo-on-shadow-host-1.html @@ -0,0 +1,25 @@ + + + + + + + + + + +

Test passes if there is a filled green square and no red.

+
+ + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html b/testing/web-platform/tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html new file mode 100644 index 0000000000..f119008ee3 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-pseudo-on-shadow-host-2.html @@ -0,0 +1,27 @@ + + + + + + + + + + + +

Test passes if there is a filled green square and no red.

+
FAIL
+ + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html b/testing/web-platform/tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html new file mode 100644 index 0000000000..e72d1b39d4 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-pseudo-on-shadow-host-3.html @@ -0,0 +1,26 @@ + + + + + + + + + + +

Test passes if there is a filled green square and no red.

+
+ + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-selector-delegatesFocus.html b/testing/web-platform/tests/shadow-dom/focus/focus-selector-delegatesFocus.html new file mode 100644 index 0000000000..bbc1346a46 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-selector-delegatesFocus.html @@ -0,0 +1,92 @@ + + + + + CSS Test (Selectors): :focus behavior with shadow hosts & delegatesFocus + + + + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-shadowhost-display-none.html b/testing/web-platform/tests/shadow-dom/focus/focus-shadowhost-display-none.html new file mode 100644 index 0000000000..40f1b01f66 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-shadowhost-display-none.html @@ -0,0 +1,68 @@ + + + + +
+ diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tab-on-shadow-host.html b/testing/web-platform/tests/shadow-dom/focus/focus-tab-on-shadow-host.html new file mode 100644 index 0000000000..0dffc0157f --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tab-on-shadow-host.html @@ -0,0 +1,31 @@ + + +HTML Test: Use tab to navigate the focus to an element inside shadow host with delegatesFocus + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-negative-delegatesFocus.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-negative-delegatesFocus.html new file mode 100644 index 0000000000..356b0bb329 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-negative-delegatesFocus.html @@ -0,0 +1,34 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom that delegates focus and all tabindex=-1 in shadow tree + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-negative.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-negative.html new file mode 100644 index 0000000000..ab25ea829b --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-negative.html @@ -0,0 +1,34 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom and negative tabindex in shadow scope + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-slot-one.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-slot-one.html new file mode 100644 index 0000000000..3c9e70867c --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-slot-one.html @@ -0,0 +1,37 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom and all tabindex=0 except for one of the slot + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-delegatesFocus.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-delegatesFocus.html new file mode 100644 index 0000000000..67899cff4a --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-delegatesFocus.html @@ -0,0 +1,36 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom that delegates focus and tabindex in shadow tree varies + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-2.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-2.html new file mode 100644 index 0000000000..1755aaf442 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-2.html @@ -0,0 +1,66 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom with varying tabindex values + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-3.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-3.html new file mode 100644 index 0000000000..e0570395ec --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex-3.html @@ -0,0 +1,80 @@ + + +HTML Test: focus - the sequential focus navigation order with nested shadow dom with varying tabindex values + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex.html new file mode 100644 index 0000000000..875e5b6814 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-tabindex.html @@ -0,0 +1,36 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom with varying tabindex values + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-delegatesFocus.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-delegatesFocus.html new file mode 100644 index 0000000000..5e6ab3a90f --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-delegatesFocus.html @@ -0,0 +1,34 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom that delegates focus and all tabindex=0 + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-negative.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-negative.html new file mode 100644 index 0000000000..b491c7d237 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-negative.html @@ -0,0 +1,35 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom and negative host tabindex + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set-scrollable.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set-scrollable.html new file mode 100644 index 0000000000..9a12d8b8f4 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set-scrollable.html @@ -0,0 +1,38 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom and scrollable/non-focusable host + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set.html new file mode 100644 index 0000000000..f257261477 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-not-set.html @@ -0,0 +1,37 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom and non-focusable host + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-one.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-one.html new file mode 100644 index 0000000000..1aa5292997 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-one.html @@ -0,0 +1,37 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom and all tabindex=0 except host (tabindex=1) + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-scrollable.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-scrollable.html new file mode 100644 index 0000000000..fa8090ca97 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-host-scrollable.html @@ -0,0 +1,36 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom and host is scrollable + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero.html b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero.html new file mode 100644 index 0000000000..d8b12ed8ac --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/focus-tabindex-order-shadow-zero.html @@ -0,0 +1,35 @@ + + +HTML Test: focus - the sequential focus navigation order with shadow dom and all tabindex=0 + + + + + + + + + diff --git a/testing/web-platform/tests/shadow-dom/focus/resources/shadow-utils.js b/testing/web-platform/tests/shadow-dom/focus/resources/shadow-utils.js new file mode 100644 index 0000000000..8033ce0169 --- /dev/null +++ b/testing/web-platform/tests/shadow-dom/focus/resources/shadow-utils.js @@ -0,0 +1,80 @@ +// Structure: +//
+//
+// #shadowRoot +//
+// +// (slotted)
+// +// (slotted)
+//
+//
+function prepareDOM(container, delegatesFocus) { + + const aboveHost = document.createElement("div"); + aboveHost.innerText = "aboveHost"; + const host = document.createElement("div"); + host.id = "host"; + const slottedBelow = document.createElement("div"); + slottedBelow.innerText = "slotted below"; + slottedBelow.slot = "below"; + const slottedAbove = document.createElement("div"); + slottedAbove.innerText = "slotted above"; + slottedAbove.slot = "above"; + + const belowHost = document.createElement("div"); + belowHost.innerText = "belowHost"; + container.appendChild(aboveHost); + container.appendChild(host); + container.appendChild(belowHost); + host.appendChild(slottedBelow); + host.appendChild(slottedAbove); + const shadowRoot = host.attachShadow({ mode: "open", delegatesFocus: delegatesFocus}); + const aboveSlot = document.createElement("div"); + aboveSlot.innerText = "aboveSlot"; + + const slotAbove = document.createElement("slot"); + slotAbove.name = "above"; + const slotBelow = document.createElement("slot"); + slotBelow.name = "below"; + + const belowSlot = document.createElement("div"); + belowSlot.innerText = "belowSlot"; + shadowRoot.appendChild(aboveSlot); + shadowRoot.appendChild(slotAbove); + shadowRoot.appendChild(slotBelow); + shadowRoot.appendChild(belowSlot); + + return [aboveHost, host, aboveSlot, slotAbove, slottedAbove, slotBelow, slottedBelow, belowSlot, belowHost]; +} + +function setTabIndex(elements, value) { + for (const el of elements) { + el.tabIndex = value; + } +} + +function removeTabIndex(elements) { + for (const el of elements) { + el.removeAttribute("tabindex"); + } +} + +function resetFocus(root = document) { + if (root.activeElement) + root.activeElement.blur(); +} + +function navigateFocusForward() { + // TAB = '\ue004' + return test_driver.send_keys(document.body, "\ue004"); +} + +async function assertFocusOrder(expectedOrder) { + const shadowRoot = document.getElementById("host").shadowRoot; + for (const el of expectedOrder) { + await navigateFocusForward(); + const focused = shadowRoot.activeElement ? shadowRoot.activeElement : document.activeElement; + assert_equals(focused, el); + } +} -- cgit v1.2.3