Bug 2067259 - Update mochitest expectations for revised font-family quoting behavior. r=firefox-style-system-reviewers,emilio

Differential Revision: https://phabricator.services.mozilla.com/D325338
This commit is contained in:
Jonathan Kew
2026-09-12 10:19:39 +00:00
committed by jkew@mozilla.com
parent a96f6b83c0
commit f48bac4bf4
2 changed files with 18 additions and 18 deletions
+9 -10
View File
@@ -29,18 +29,17 @@ function runTest() {
{ rule: "@font-face { ; }", d: {}, noncanonical: true },
// Correct font-family.
{ rule: _("font-family: \"Mouse\";"), d: {"font-family" : "\"Mouse\""} },
{ rule: _("font-family: \"Mouse\""), d: {"font-family" : "\"Mouse\""},
{ rule: _("font-family: \"Mouse\";"), d: {"font-family" : "Mouse"},
noncanonical: true },
{ rule: _("font-family: Mouse;"), d: {"font-family" : "Mouse" },
{ rule: _("font-family: \"Mouse\""), d: {"font-family" : "Mouse"},
noncanonical: true },
{ rule: _("font-family: Mouse;"), d: {"font-family" : "Mouse" } },
{ rule: _("font-family: Mouse"), d: {"font-family" : "Mouse" },
noncanonical: true },
// Correct but unusual font-family.
{ rule: _("font-family: Hoefler Text;"),
d: {"font-family" : "Hoefler Text"},
noncanonical: true },
d: {"font-family" : "Hoefler Text"} },
// Incorrect font-family.
{ rule: _("font-family:"), d: {} },
@@ -137,7 +136,7 @@ function runTest() {
d: { "src" : "url(\"/fonts/Mouse\"), url(\"/fonts/Rat\")" } },
{ rule: _("src: local(Mouse), url(\"/fonts/Mouse\");"),
d: { "src" : "local(Mouse), url(\"/fonts/Mouse\")" },
d: { "src" : "local(\"Mouse\"), url(\"/fonts/Mouse\")" },
noncanonical: true },
{ rule: _("src: local(\"老鼠\"), url(\"/fonts/Mouse\");"),
@@ -151,7 +150,7 @@ function runTest() {
// Correct but unusual src:
{ rule: _("src: local(Hoefler Text);"),
d: {"src" : "local(Hoefler Text)"}, noncanonical: true },
d: {"src" : "local(\"Hoefler Text\")"}, noncanonical: true },
// Incorrect src:
{ rule: _("src:"), d: {} },
@@ -173,15 +172,15 @@ function runTest() {
d: { "src" : "url(\"/fonts/Mouse\")" },
noncanonical: true },
{ rule: _("src: local(Cat); src: local(Mouse)"),
d: { "src" : "local(Mouse)" },
d: { "src" : "local(\"Mouse\")" },
noncanonical: true },
// Correct parenthesis matching for local()
{ rule: _("src: local(Mouse); src: local(Cat(); src: local(Rat); )"),
d: { "src" : "local(Mouse)" },
d: { "src" : "local(\"Mouse\")" },
noncanonical: true },
{ rule: _("src: local(Mouse); src: local(\"Cat\"; src: local(Rat); )"),
d: { "src" : "local(Mouse)" },
d: { "src" : "local(\"Mouse\")" },
noncanonical: true },
// Correct parenthesis matching for format()
@@ -6,12 +6,13 @@
<div id="log"></div>
<div id="display"></div>
<script>
// This cannot be a web-platform test because this doesn't match what
// the spec says at the moment. Specifically, the spec wants to have
// all font family serialized to string, while in practice, all browsers
// serialize simple them to identifiers in some cases.
// We want to check our current behavior. This can be changed once
// browsers have an agreement on the exact behavior to spec.
// Serialization of font-family names,
// see https://github.com/w3c/csswg-drafts/issues/5846:
// - Quote if it matches an existing keyword (already required per spec).
// - Quote if it cannot be serialized as a keyword without escapes, e.g.:
// - contains non-alphanumeric ASCII;
// - contains a word that begins with a number.
// - Otherwise serialize as space-separated idents.
// format: [input, expected serialization]
const tests = [
@@ -20,7 +21,7 @@ const tests = [
[' simple ', 'simple'],
['multi idents font', 'multi idents font'],
[' multi idents font ', 'multi idents font'],
['"wrapped name"', '"wrapped name"'],
['"wrapped name"', 'wrapped name'],
['" wrapped name "', '" wrapped name "'],
// Special whitespaces
@@ -33,7 +34,7 @@ const tests = [
['trailing ws\\ ', '"trailing ws "'],
['trailing ws \\ ', '"trailing ws "'],
['trailing ws\\ \\ ', '"trailing ws "'],
['escaped\\ ws', '"escaped ws"'],
['escaped\\ ws', 'escaped ws'],
['escaped\\ ws', '"escaped ws"'],
['escaped\\ \\ ws', '"escaped ws"'],
['escaped \\ ws', '"escaped ws"'],