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 /layout/inspector/tests/test_isinheritableproperty.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 'layout/inspector/tests/test_isinheritableproperty.html')
-rw-r--r-- | layout/inspector/tests/test_isinheritableproperty.html | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/layout/inspector/tests/test_isinheritableproperty.html b/layout/inspector/tests/test_isinheritableproperty.html new file mode 100644 index 0000000000..9f9340535c --- /dev/null +++ b/layout/inspector/tests/test_isinheritableproperty.html @@ -0,0 +1,84 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=699592 +--> +<head> + <title>Test for InspectorUtils::isInheritedProperty</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> + <style> + @property --css-registered-inherits { + syntax: "*"; + inherits: true; + } + @property --css-registered-no-inherits { + syntax: "*"; + inherits: false; + } + </style> + <script> + CSS.registerProperty({ + name: "--js-registered-inherits", + syntax: "*", + inherits: true, + }); + CSS.registerProperty({ + name: "--js-registered-no-inherits", + syntax: "*", + inherits: false, + }); + </script> +</head> +<body> +<pre id="test"> +<script type="application/javascript"> + +function do_test() { + const isInherited = (name) => + SpecialPowers.InspectorUtils.isInheritedProperty(document, name); + + is(isInherited("font-size"), true, "font-size is inherited."); + is(isInherited("min-width"), false, "min-width is not inherited."); + + is(isInherited("font"), true, "shorthand font property is inherited."); + + is(isInherited("border"), false, "shorthand border property not inherited."); + is(isInherited("garbage"), false, "Unknown property isn't inherited."); + + info("Checking isInheritedProperty result on custom properties"); + is(isInherited("--unregistered-var"),true, + "Unregistered custom property is inherited." + ); + is( + isInherited("--css-registered-inherits"), + true, + "Returns true for @property that inherits" + ); + is( + isInherited("--css-registered-no-inherits"), + false, + "Returns false for @property that does not inherits" + ); + is( + isInherited("--js-registered-inherits"), + true, + "Returns true for property registered in JS that inherits" + ); + is( + isInherited("--js-registered-no-inherits"), + false, + "Returns false for property registered in JS that does not inherits" + ); + + SimpleTest.finish(); +} + +SimpleTest.waitForExplicitFinish(); +addLoadEvent(do_test); + + +</script> +</pre> +</body> +</html> |