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/css/css-fonts/parsing/font-face-src-local.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/css/css-fonts/parsing/font-face-src-local.html')
-rw-r--r-- | testing/web-platform/tests/css/css-fonts/parsing/font-face-src-local.html | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-fonts/parsing/font-face-src-local.html b/testing/web-platform/tests/css/css-fonts/parsing/font-face-src-local.html new file mode 100644 index 0000000000..30c435afaf --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/parsing/font-face-src-local.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<title>CSS Fonts Module Level 4: parsing @font-face src:local()</title> +<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#local-font-fallback"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style id="testStyle"> +</style> +<script> + const sheet = testStyle.sheet; + tests = [ + // Gargbage data following valid local() is not valid + { src:'local(A) dummy()', valid:false}, + // Gargbage data preceding valid local() is not valid + { src:'dummy() local(A)', valid:false}, + // Unquoted collapsing space + { src:'local( A )', valid:true }, + { src:'local(A B)', valid:true }, + { src:'local(A B)', valid:true }, + { src:'local( A B )', valid:true }, + // Unquoted local() with invalid CSS-wide keywords excluded from <custom-ident> + { src:'local(default)', valid:false }, + { src:'local(inherit)', valid:false }, + { src:'local(revert)', valid:false }, + { src:'local(unset)', valid:false }, + // Unquoted local() with CSS-wide keywords as part of the name + { src:'local(default A)', valid:true }, + { src:'local(inherit A)', valid:true }, + { src:'local(revert A)', valid:true }, + { src:'local(unset A)', valid:true }, + // Quoted local() with CSS-wide keywords + { src:'local("default")', valid:true }, + { src:'local("inherit")', valid:true }, + { src:'local("revert")', valid:true }, + { src:'local("unset")', valid:true } + ]; + + for (let t of tests) { + test(() => { + assert_equals(sheet.cssRules.length, 0, "testSheet should initially be empty"); + sheet.insertRule("@font-face { src: " + t.src + "}"); + assert_equals(sheet.cssRules[0].style.getPropertyValue("src") != "", t.valid); + sheet.deleteRule(0); + }, "Check that src: " + t.src + " is " + (t.valid ? "valid" : "invalid")); + } +</script> |