mirror of
https://github.com/servo/servo.git
synced 2025-08-14 01:45:33 +01:00
Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'
This commit is contained in:
parent
ace9b32b1c
commit
df68c4e5d1
15632 changed files with 514865 additions and 155000 deletions
|
@ -0,0 +1,68 @@
|
|||
<!DOCTYPE html>
|
||||
<title>CSS Fonts 4 test: parsing the format() function in the src descriptor</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-fonts/#font-face-src-parsing">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style id="testStyle">
|
||||
</style>
|
||||
<script>
|
||||
const sheet = testStyle.sheet;
|
||||
tests = [
|
||||
// No format() function
|
||||
{ src: 'url("foo.ttf")', valid: true },
|
||||
{ src: 'url("foo.ttf"), url("bar.ttf")', valid: true },
|
||||
// Empty format() is not valid
|
||||
{ src: 'url("foo.ttf") format()', valid: false },
|
||||
// Quoted strings in format()
|
||||
{ src: 'url("foo.ttf") format("collection")', valid: true },
|
||||
{ src: 'url("foo.ttf") format("opentype")', valid: true },
|
||||
{ src: 'url("foo.ttf") format("truetype")', valid: true },
|
||||
{ src: 'url("foo.ttf") format("woff")', valid: true },
|
||||
{ src: 'url("foo.ttf") format("woff2")', valid: true },
|
||||
// Multiple strings (was valid in CSS Fonts 3, but not allowed in Fonts 4)
|
||||
{ src: 'url("foo.ttf") format("opentype", "truetype")', valid: false },
|
||||
// Keywords (new in Fonts 4)
|
||||
{ src: 'url("foo.ttf") format(collection)', valid: true },
|
||||
{ src: 'url("foo.ttf") format(opentype)', valid: true },
|
||||
{ src: 'url("foo.ttf") format(truetype)', valid: true },
|
||||
{ src: 'url("foo.ttf") format(woff)', valid: true },
|
||||
{ src: 'url("foo.ttf") format(woff2)', valid: true },
|
||||
// Multiple keywords are not accepted
|
||||
{ src: 'url("foo.ttf") format(opentype, truetype)', valid: false },
|
||||
{ src: 'url("foo.ttf") format(opentype truetype)', valid: false },
|
||||
// Invalid format keywords should be a parse error
|
||||
{ src: 'url("foo.ttf") format(auto)', valid: false },
|
||||
{ src: 'url("foo.ttf") format(default)', valid: false },
|
||||
{ src: 'url("foo.ttf") format(inherit)', valid: false },
|
||||
{ src: 'url("foo.ttf") format(initial)', valid: false },
|
||||
{ src: 'url("foo.ttf") format(none)', valid: false },
|
||||
{ src: 'url("foo.ttf") format(normal)', valid: false },
|
||||
{ src: 'url("foo.ttf") format(xyzzy)', valid: false },
|
||||
// Unknown format string still matches the grammar, although it won't be
|
||||
// loaded. UAs may choose to either not load it, or not add unsupported
|
||||
// entries to the list, ensure that subsequent component of the list are
|
||||
// still recognized.
|
||||
{ src: 'url("foo.ttf") format("embedded-opentype"), url("bar.html")', valid: true },
|
||||
{ src: 'url("foo.ttf") format(embedded-opentype), url("bar.html")', valid: true },
|
||||
{ src: 'url("foo.ttf") format("svg"), url("bar.html")', valid: true },
|
||||
{ src: 'url("foo.ttf") format(svg), url("bar.html")', valid: true },
|
||||
// Hard parsing errors should make the line invalid.
|
||||
{ src: 'url("foo.ttf") format(xyzz 200px), url("bar.html")', valid: false },
|
||||
{ src: 'url("foo.ttf") format(xyzz), url("bar.html")', valid: false },
|
||||
{ src: 'url("foo.ttf") dummy(xyzzy), url("bar.html")', valid: false },
|
||||
{ src: 'url("foo.ttf") format(), url("bar.html")', valid: false },
|
||||
{ src: 'url("foo.ttf") format(none), url("bar.html")', valid: false },
|
||||
];
|
||||
|
||||
for (let t of tests) {
|
||||
test(() => {
|
||||
assert_equals(sheet.cssRules.length, 0, "testSheet should initially be empty");
|
||||
sheet.insertRule("@font-face { src: " + t.src + "}");
|
||||
try {
|
||||
assert_equals(sheet.cssRules[0].style.getPropertyValue("src") != "", t.valid);
|
||||
} finally {
|
||||
sheet.deleteRule(0);
|
||||
}
|
||||
}, "Check that src: " + t.src + " is " + (t.valid ? "valid" : "invalid"));
|
||||
}
|
||||
</script>
|
|
@ -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>
|
|
@ -0,0 +1,89 @@
|
|||
<!DOCTYPE html>
|
||||
<title>CSS Fonts 4 test: parsing the tech() function in the src descriptor</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-fonts/#font-face-src-parsing">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style id="testStyle">
|
||||
</style>
|
||||
<script>
|
||||
const sheet = testStyle.sheet;
|
||||
tests = [
|
||||
// No tech() function
|
||||
{ src: 'url("foo.ttf")', valid: true },
|
||||
// Empty tech() is not valid
|
||||
{ src: 'url("foo.ttf") tech()', valid: false },
|
||||
// Check that each valid keyword is accepted
|
||||
{ src: 'url("foo.ttf") tech(features-opentype)', valid: true },
|
||||
{ src: 'url("foo.ttf") tech(features-aat)', valid: true },
|
||||
{ src: 'url("foo.ttf") tech(color-COLRv0)', valid: true },
|
||||
{ src: 'url("foo.ttf") tech(color-COLRv1)', valid: true },
|
||||
{ src: 'url("foo.ttf") tech(color-sbix)', valid: true },
|
||||
{ src: 'url("foo.ttf") tech(color-CBDT)', valid: true },
|
||||
{ src: 'url("foo.ttf") tech(variations)', valid: true },
|
||||
{ src: 'url("foo.ttf") tech(palettes)', valid: true },
|
||||
// tech() does not accept strings (unlike format()!)
|
||||
{ src: 'url("foo.ttf") tech("features-opentype")', valid: false },
|
||||
{ src: 'url("foo.ttf") tech("color-COLRv0")', valid: false },
|
||||
{ src: 'url("foo.ttf") tech("variations")', valid: false },
|
||||
// tech() accepts a comma-separated list of keywords
|
||||
{ src: 'url("foo.ttf") tech(features-opentype, color-COLRv0, variations, palettes)', valid: true },
|
||||
{ src: 'url("foo.ttf") tech(features-opentype color-COLRv0 variations palettes)', valid: false },
|
||||
// Invalid font-tech keywords should be a parse error
|
||||
{ src: 'url("foo.ttf") tech(feature-opentype)', valid: false },
|
||||
{ src: 'url("foo.ttf") tech(feature-aat)', valid: false },
|
||||
{ src: 'url("foo.ttf") tech(feature-graphite)', valid: false },
|
||||
{ src: 'url("foo.ttf") tech(auto)', valid: false },
|
||||
{ src: 'url("foo.ttf") tech(default)', valid: false },
|
||||
{ src: 'url("foo.ttf") tech(inherit)', valid: false },
|
||||
{ src: 'url("foo.ttf") tech(initial)', valid: false },
|
||||
{ src: 'url("foo.ttf") tech(none)', valid: false },
|
||||
{ src: 'url("foo.ttf") tech(normal)', valid: false },
|
||||
{ src: 'url("foo.ttf") tech(xyzzy)', valid: false },
|
||||
// format() function must precede tech() if both are present
|
||||
{ src: 'url("foo.ttf") format(opentype) tech(features-opentype)', valid: true },
|
||||
{ src: 'url("foo.ttf") tech(features-opentype) format(opentype)', valid: false },
|
||||
// Unsupported technology (for example: no browser has incremental transfer yet), might be
|
||||
// dropped from the list, next component of the list should be accepted.
|
||||
{ src: 'url("foo.ttf") tech(incremental), url("bar.html")', dontcomparetech: true, valid: true },
|
||||
{ src: 'url("foo.ttf") tech(incremental, color-SVG, features-graphite, features-aat), url("bar.html")', dontcomparetech: true, valid: true },
|
||||
{ src: 'url("foo.ttf") tech(color-SVG, features-graphite), url("bar.html")', dontcomparetech: true, valid: true },
|
||||
{ src: 'url("foo.ttf") tech(color-SVG), url("bar.html")', dontcomparetech: true, valid: true },
|
||||
{ src: 'url("foo.ttf") tech(features-graphite), url("bar.html")', dontcomparetech: true, valid: true },
|
||||
// No invalid functions.
|
||||
{ src: 'url("foo.ttf") dummy("opentype") tech(variations)', valid: false },
|
||||
{ src: 'url("foo.ttf") dummy("opentype") dummy(variations)', valid: false },
|
||||
{ src: 'url("foo.ttf") format(opentype) tech(features-opentype) dummy(something)', valid: false },
|
||||
// Valid value after unparseable value must be ignored.
|
||||
{ src: 'url("foo.ttf") format(dummy), url("foo.ttf") tech(variations)', valid: false },
|
||||
{ src: 'url("foo.ttf") tech(color, url("bar.html")', valid: false },
|
||||
];
|
||||
|
||||
// Assert that the two arguments have the same set of keywords in the tech() function,
|
||||
// (although their ordering may differ).
|
||||
function check_same_tech(serialized, specified) {
|
||||
if (!specified.includes("tech(")) {
|
||||
assert_false(serialized.includes("tech("), "expected no tech() function");
|
||||
return;
|
||||
}
|
||||
// Extract the lists of tech() keywords and sort them for comparison.
|
||||
const tech = /tech\((.+)\)/;
|
||||
var specified_techs = tech.exec(specified)[1].split(/,\s*/).sort().join(", ");
|
||||
var serialized_techs = tech.exec(serialized)[1].split(/,\s*/).sort().join(", ");
|
||||
assert_equals(serialized_techs, specified_techs, "expected matching tech() lists");
|
||||
}
|
||||
|
||||
for (let t of tests) {
|
||||
test(() => {
|
||||
assert_equals(sheet.cssRules.length, 0, "testSheet should initially be empty");
|
||||
sheet.insertRule("@font-face { src: " + t.src + "}");
|
||||
try {
|
||||
assert_equals(sheet.cssRules[0].style.getPropertyValue("src") != "", t.valid);
|
||||
if (t.valid && !t.dontcomparetech) {
|
||||
check_same_tech(sheet.cssRules[0].style.getPropertyValue("src"), t.src);
|
||||
}
|
||||
} finally {
|
||||
sheet.deleteRule(0);
|
||||
}
|
||||
}, "Check that src: " + t.src + " is " + (t.valid ? "valid" : "invalid"));
|
||||
}
|
||||
</script>
|
|
@ -24,6 +24,12 @@ test_invalid_value('font', 'normal normal normal normal normal 20%/1.2 \"FB Arma
|
|||
test_invalid_value('font', 'italic small-caps lighter condensed smaller');
|
||||
test_invalid_value('font', 'normal 100 semi-condensed oblique small-caps Menu');
|
||||
test_invalid_value('font', '100% larger / 2 fantasy');
|
||||
|
||||
test_invalid_value('font', 'oldstyle-nums medium serif');
|
||||
test_invalid_value('font', 'common-ligatures medium serif');
|
||||
test_invalid_value('font', 'normal full-width medium serif');
|
||||
test_invalid_value('font', 'italic titling-caps medium serif');
|
||||
test_invalid_value('font', 'petite-caps medium serif');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -103,6 +103,10 @@
|
|||
<body>
|
||||
<script>
|
||||
let rules = document.getElementById("style").sheet.cssRules;
|
||||
let supports_lab = CSS.supports('color', 'lab(29.2345% 39.3825 20.0664)');
|
||||
let supports_display_p3_color_space =
|
||||
CSS.supports('color', 'color(display-p3 100% 100% 100%)');
|
||||
|
||||
test(function() {
|
||||
let text = rules[0].cssText;
|
||||
assert_not_equals(text.indexOf("@font-palette-values "), -1);
|
||||
|
@ -259,7 +263,8 @@ test(function() {
|
|||
test(function() {
|
||||
let text = rules[9].cssText;
|
||||
assert_not_equals(text.indexOf("override-colors"), -1);
|
||||
assert_not_equals(text.indexOf("rgb(0, 128, 0)"), -1);
|
||||
assert_true(text.includes("rgb(0, 128, 0)") ||
|
||||
text.includes("green"));
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -268,13 +273,15 @@ test(function() {
|
|||
assert_equals(rule.fontFamily, "");
|
||||
assert_equals(rule.basePalette, "");
|
||||
assert_equals(rule.overrideColors.indexOf("),"), -1);
|
||||
assert_not_equals(rule.overrideColors.indexOf("rgb(0, 128, 0)"), -1);
|
||||
assert_true(rule.overrideColors.includes("rgb(0, 128, 0)") ||
|
||||
rule.overrideColors.includes("green"))
|
||||
});
|
||||
|
||||
test(function() {
|
||||
let text = rules[10].cssText;
|
||||
assert_not_equals(text.indexOf("override-colors"), -1);
|
||||
assert_not_equals(text.indexOf("rgba(0, 0, 0, 0)"), -1);
|
||||
assert_true(text.includes("rgba(0, 0, 0, 0)") ||
|
||||
text.includes("transparent"));
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -283,7 +290,8 @@ test(function() {
|
|||
assert_equals(rule.fontFamily, "");
|
||||
assert_equals(rule.basePalette, "");
|
||||
assert_equals(rule.overrideColors.indexOf("),"), -1);
|
||||
assert_not_equals(rule.overrideColors.indexOf("rgba(0, 0, 0, 0)"), -1);
|
||||
assert_true(rule.overrideColors.includes("rgba(0, 0, 0, 0)") ||
|
||||
rule.overrideColors.includes("transparent"));
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -303,8 +311,10 @@ test(function() {
|
|||
|
||||
test(function() {
|
||||
let text = rules[12].cssText;
|
||||
assert_not_equals(text.indexOf("override-colors"), -1);
|
||||
assert_not_equals(text.indexOf("29"), -1);
|
||||
if (supports_lab) {
|
||||
assert_not_equals(text.indexOf("override-colors"), -1);
|
||||
assert_not_equals(text.indexOf("29"), -1);
|
||||
}
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -312,14 +322,18 @@ test(function() {
|
|||
assert_equals(rule.name, "--M");
|
||||
assert_equals(rule.fontFamily, "");
|
||||
assert_equals(rule.basePalette, "");
|
||||
assert_equals(rule.overrideColors.indexOf("),"), -1);
|
||||
assert_not_equals(rule.overrideColors.indexOf("lab"), -1);
|
||||
if (supports_lab) {
|
||||
assert_equals(rule.overrideColors.indexOf("),"), -1);
|
||||
assert_not_equals(rule.overrideColors.indexOf("lab"), -1);
|
||||
}
|
||||
});
|
||||
|
||||
test(function() {
|
||||
let text = rules[13].cssText;
|
||||
assert_not_equals(text.indexOf("override-colors"), -1);
|
||||
assert_not_equals(text.indexOf("display-p3"), -1);
|
||||
if (supports_display_p3_color_space) {
|
||||
assert_not_equals(text.indexOf("override-colors"), -1);
|
||||
assert_not_equals(text.indexOf("display-p3"), -1);
|
||||
}
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
@ -327,8 +341,10 @@ test(function() {
|
|||
assert_equals(rule.name, "--N");
|
||||
assert_equals(rule.fontFamily, "");
|
||||
assert_equals(rule.basePalette, "");
|
||||
assert_equals(rule.overrideColors.indexOf("),"), -1);
|
||||
assert_not_equals(rule.overrideColors.indexOf("display-p3"), -1);
|
||||
if (supports_display_p3_color_space) {
|
||||
assert_equals(rule.overrideColors.indexOf("),"), -1);
|
||||
assert_not_equals(rule.overrideColors.indexOf("display-p3"), -1);
|
||||
}
|
||||
});
|
||||
|
||||
test(function() {
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Fonts Module Level 4: font-variant vs font shorthand</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-prop">
|
||||
<meta name="assert" content="Only the CSS2 font-variant values (normal | small-caps) are supported by the font shorthand.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
<div id="target"></div>
|
||||
</div>
|
||||
<script>
|
||||
test(() => {
|
||||
const target = document.getElementById('target');
|
||||
target.style.font = "medium serif";
|
||||
target.style.fontVariant = "small-caps";
|
||||
assert_equals(target.style.font, "small-caps medium serif", "font should be updated");
|
||||
target.style.fontVariant = "titling-caps";
|
||||
assert_equals(target.style.font, "", "font should be empty");
|
||||
target.style.fontVariant = "normal";
|
||||
assert_equals(target.style.font, "medium serif", "font should be reset");
|
||||
target.style.fontVariant = "full-width";
|
||||
assert_equals(target.style.font, "", "font should be empty");
|
||||
}, "font shorthand returns only CSS2 font-variant values");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -16,6 +16,14 @@ test_invalid_value('font-variant-east-asian', 'normal ruby');
|
|||
test_invalid_value('font-variant-east-asian', 'jis78 jis83');
|
||||
|
||||
test_invalid_value('font-variant-east-asian', 'full-width proportional-width');
|
||||
|
||||
test_invalid_value('font-variant-east-asian', 'normal garbage');
|
||||
test_invalid_value('font-variant-east-asian', 'normal none');
|
||||
test_invalid_value('font-variant-east-asian', 'normal 30px');
|
||||
|
||||
test_invalid_value('font-variant-east-asian', 'full-width garbage');
|
||||
test_invalid_value('font-variant-east-asian', 'full-width none');
|
||||
test_invalid_value('font-variant-east-asian', 'full-width 30px');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Fonts Module Level 4: getComputedStyle().fontVariantEmoji</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-variant-emoji-prop">
|
||||
<meta name="assert" content="font-variant-emoji computed value is as specified.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/computed-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
test_computed_value('font-variant-emoji', 'normal');
|
||||
test_computed_value('font-variant-emoji', 'text');
|
||||
test_computed_value('font-variant-emoji', 'emoji');
|
||||
test_computed_value('font-variant-emoji', 'unicode');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Fonts Module Level 4: parsing font-variant-emoji with invalid values</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-variant-emoji-prop">
|
||||
<meta name="assert" content="font-variant-emoji supports only the grammar 'normal | text | emoji | unicode'.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/parsing-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test_invalid_value('font-variant-emoji', 'auto');
|
||||
test_invalid_value('font-variant-emoji', 'none');
|
||||
test_invalid_value('font-variant-emoji', 'color');
|
||||
test_invalid_value('font-variant-emoji', 'normal text');
|
||||
test_invalid_value('font-variant-emoji', 'text emoji');
|
||||
test_invalid_value('font-variant-emoji', 'normal, unicode');
|
||||
test_invalid_value('font-variant-emoji', 'unicode, emoji');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Fonts Module Level 4: parsing font-variant-emoji with valid values</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-variant-emoji-prop">
|
||||
<meta name="assert" content="font-variant-emoji supports the full grammar 'normal | text | emoji | unicode'.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/parsing-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test_valid_value('font-variant-emoji', 'normal');
|
||||
test_valid_value('font-variant-emoji', 'text');
|
||||
test_valid_value('font-variant-emoji', 'emoji');
|
||||
test_valid_value('font-variant-emoji', 'unicode');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -32,7 +32,8 @@ test_valid_value('font-variant-numeric', 'slashed-zero');
|
|||
test_valid_value('font-variant-numeric', 'oldstyle-nums tabular-nums diagonal-fractions');
|
||||
|
||||
// Blink gives "slashed-zero ordinal stacked-fractions proportional-nums lining-nums".
|
||||
test_valid_value('font-variant-numeric', 'slashed-zero ordinal stacked-fractions proportional-nums lining-nums', 'lining-nums proportional-nums stacked-fractions ordinal slashed-zero');
|
||||
// Also accept specified order as correct serialization.
|
||||
test_valid_value('font-variant-numeric', 'slashed-zero ordinal stacked-fractions proportional-nums lining-nums', ['slashed-zero ordinal stacked-fractions proportional-nums lining-nums', 'lining-nums proportional-nums stacked-fractions ordinal slashed-zero']);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Fonts Module Level 4: serialization of font-variant</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#propdef-font-variant">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1797146">
|
||||
<meta name="assert" content="re-setting font-variant to its serialization should be idempotent">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=target style=""></div>
|
||||
<script>
|
||||
test(function(){
|
||||
let div = document.getElementById("target");
|
||||
let sty = div.style;
|
||||
|
||||
sty.font = "12px serif";
|
||||
v = sty.fontVariant;
|
||||
assert_in_array(v, ["", "normal"]); // Accept either explicit 'normal' or empty.
|
||||
sty.fontVariant = v;
|
||||
assert_equals(sty.fontVariant, v);
|
||||
|
||||
sty.font = "menu";
|
||||
v = sty.fontVariant;
|
||||
assert_in_array(v, ["", "normal"]);
|
||||
|
||||
sty.font = "12px serif"
|
||||
sty.fontVariantNumeric = "tabular-nums";
|
||||
v = sty.fontVariant;
|
||||
assert_equals(v, "tabular-nums");
|
||||
sty.fontVariant = v;
|
||||
assert_equals(sty.fontVariant, v);
|
||||
|
||||
sty.font = "menu"
|
||||
sty.fontVariantNumeric = "tabular-nums";
|
||||
v = sty.fontVariant;
|
||||
assert_equals(v, "tabular-nums");
|
||||
sty.fontVariant = v;
|
||||
assert_equals(sty.fontVariant, v);
|
||||
|
||||
sty.font = "12px serif"
|
||||
sty.fontVariantNumeric = "tabular-nums";
|
||||
sty.fontVariantCaps = "small-caps";
|
||||
v = sty.fontVariant;
|
||||
sty.fontVariant = v;
|
||||
assert_equals(sty.fontVariant, v);
|
||||
|
||||
sty.font = "menu"
|
||||
sty.fontVariantNumeric = "tabular-nums";
|
||||
sty.fontVariantCaps = "small-caps";
|
||||
v = sty.fontVariant;
|
||||
sty.fontVariant = v;
|
||||
assert_equals(sty.fontVariant, v);
|
||||
}, "checking serialized value of font-variant");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue