diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/html/rendering/non-replaced-elements/flow-content-0/slot-element-focusable.tentative.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/rendering/non-replaced-elements/flow-content-0/slot-element-focusable.tentative.html')
-rw-r--r-- | testing/web-platform/tests/html/rendering/non-replaced-elements/flow-content-0/slot-element-focusable.tentative.html | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/rendering/non-replaced-elements/flow-content-0/slot-element-focusable.tentative.html b/testing/web-platform/tests/html/rendering/non-replaced-elements/flow-content-0/slot-element-focusable.tentative.html new file mode 100644 index 0000000000..b6d2449e89 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/non-replaced-elements/flow-content-0/slot-element-focusable.tentative.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<title>CSS Test (Display): <slot> elements should be focusable</title> +<link rel="author" title="L. David Baron" href="https://dbaron.org/"> +<link rel="author" title="Google" href="http://www.google.com/"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#flow-content-3"> +<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/2632"> +<link rel="help" href="https://github.com/whatwg/html/issues/1837"> +<link rel="help" href="https://github.com/whatwg/html/pull/9425"> +<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1366037"> +<!-- + + This requirement is not particularly clear from current specs, + so this test is tentative. See issues above. + +--> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<body> + +<script> + + function do_test(slot_style, description) { + test( + function() { + let host = document.createElement("div"); + document.body.appendChild(host); + var root = host.attachShadow({mode:"open"}); + root.innerHTML = ` + <style> + slot { --test-value: slot-not-focused; } + slot:focus { --test-value: slot-is-focused; } + </style> + <slot tabindex="1" style="${slot_style}"></slot> + `; + let slot = root.querySelector("slot"); + let cs = getComputedStyle(slot); + assert_not_equals(root.activeElement, slot, "precondition"); + assert_equals(cs.getPropertyValue("--test-value"), "slot-not-focused", "precondition (style)"); + slot.focus(); + assert_equals(root.activeElement, slot, "slot is now focused"); + assert_equals(cs.getPropertyValue("--test-value"), "slot-is-focused", "slot is now focused (style)"); + document.body.removeChild(host); + }, `slot element with ${description} should be focusable`); + } + + do_test("display: block", "display: block"); + do_test("", "default style"); + +</script> + |