diff options
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 | 41 |
1 files changed, 41 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..d7c8cba18c --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/parsing/font-face-src-local.html @@ -0,0 +1,41 @@ +<!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 = [ + // 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> |