diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /layout/inspector/tests/test_getCSSStyleRules_pseudo.html | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/inspector/tests/test_getCSSStyleRules_pseudo.html')
-rw-r--r-- | layout/inspector/tests/test_getCSSStyleRules_pseudo.html | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/layout/inspector/tests/test_getCSSStyleRules_pseudo.html b/layout/inspector/tests/test_getCSSStyleRules_pseudo.html new file mode 100644 index 0000000000..097a66baed --- /dev/null +++ b/layout/inspector/tests/test_getCSSStyleRules_pseudo.html @@ -0,0 +1,76 @@ +<!DOCTYPE html> +<title>Test getCSSStyleRules for pseudo elements</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<link rel="stylesheet" href="/tests/SimpleTest/test.css"> + +<style> +#block:before { + display: block; + content: ":before"; +} +#block:after { + display: block; + content: ":after"; +} + +#table:before { + display: table; + content: ":before"; +} +#table:after { + display: table; + content: ":after"; +} + +#flex:before { + display: flex; + content: ":before"; +} +#flex:after { + display: flex; + content: ":after"; +} + +#grid:before { + display: grid; + content: ":before"; +} +#grid:after { + display: grid; + content: ":after"; +} +</style> + +<div id="block">block pseudos</div> +<div id="table">table pseudos</div> +<div id="flex">flex pseudos</div> +<div id="grid">grid pseudos</div> + +<script> +const InspectorUtils = SpecialPowers.InspectorUtils; + +function checkPseudoStyleForId(id) { + let element = document.getElementById(id); + + let beforeRules = InspectorUtils.getCSSStyleRules(element, ":before"); + is (beforeRules.length, 1, "Element " + id + ":before has expected number of rules."); + let beforeDecl = beforeRules[0].style; + is (beforeDecl.content, '":before"', "Element " + id + ":before has expected style content."); + + let afterRules = InspectorUtils.getCSSStyleRules(element, ":after"); + is (afterRules.length, 1, "Element " + id + ":after has expected number of rules."); + let afterDecl = afterRules[0].style; + is (afterDecl.content, '":after"', "Element " + id + ":after has expected style content."); +} + +let idsToCheck = [ + "block", + "table", + "flex", + "grid", +]; + +for (let id of idsToCheck) { + checkPseudoStyleForId(id); +} +</script> |