diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /layout/style/test/test_descriptor_syntax_errors.html | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/style/test/test_descriptor_syntax_errors.html')
-rw-r--r-- | layout/style/test/test_descriptor_syntax_errors.html | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/layout/style/test/test_descriptor_syntax_errors.html b/layout/style/test/test_descriptor_syntax_errors.html new file mode 100644 index 0000000000..bf73b15b64 --- /dev/null +++ b/layout/style/test/test_descriptor_syntax_errors.html @@ -0,0 +1,53 @@ +<!DOCTYPE HTML> +<html> +<!-- +--> +<head> + <title>Test that we reject syntax errors listed in descriptor_database.js</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="descriptor_database.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +<p id="display"></p> +<div id="content" style="display: none"> +</div> +<pre id="test"> +<script class="testbody" type="text/javascript"> + +var gStyleElement = document.createElement("style"); +gStyleElement.setAttribute("type", "text/css"); +document.getElementsByTagName("head")[0].appendChild(gStyleElement); +var gSheet = gStyleElement.sheet; +gSheet.insertRule("@font-face { }", 0); +var gRule = gSheet.cssRules[0]; +var gDeclaration = gRule.style; + +function fake_set_property(descriptor, value) { + gSheet.deleteRule(0); + gSheet.insertRule("@font-face { " + descriptor + ": " + value + "}", 0); + gRule = gSheet.cssRules[0]; + gDeclaration = gRule.style; +} + +for (var descriptor in gCSSFontFaceDescriptors) { + var info = gCSSFontFaceDescriptors[descriptor]; + for (var idx in info.invalid_values) { + var badval = info.invalid_values[idx]; + +// // We don't implement SetProperty yet (bug 443978). +// gDeclaration.setProperty(descriptor, badval, ""); + fake_set_property(descriptor, badval); + + is(gDeclaration.getPropertyValue(descriptor), "", + "invalid value '" + badval + "' not accepted for '" + descriptor + + "' descriptor"); + + gDeclaration.removeProperty(descriptor); + } +} + +</script> +</pre> +</body> +</html> |