Skip to content

Commit

Permalink
Bug 1900232: Part 6 - Adjust test expectations for anchor-size. r=f…
Browse files Browse the repository at this point in the history
…irefox-style-system-reviewers,devtools-reviewers,nchevobbe,emilio

1. WPT tests now accept `anchor-size()` property for sizing, inset, and
   margin properties [1].
2. Adjust test expectations for `anchor-size()` fallbacks containing
   `anchor-size()` - This will need to be followed up once [2] is resolved.
3. Adjust expectations for devtools' auto-completion related mochitests.
4. We don't yet handle `anchor-size()` in `calc()`.

[1] w3c/csswg-drafts#9827
[2] w3c/csswg-drafts#10831

Differential Revision: https://phabricator.services.mozilla.com/D222535
  • Loading branch information
dshin-moz committed Sep 23, 2024
1 parent 9697024 commit d35677e
Show file tree
Hide file tree
Showing 7 changed files with 2,584 additions and 1,527 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,23 @@ async function checkStateAndMoveOn() {
return;
}

const [lineCh, expectedSuggestions] = tests[index];
const [lineCh, baseExpectedSuggestions, prefSuggestions] = tests[index];
const [line, ch] = lineCh;

let expectedSuggestions;
if (prefSuggestions) {
const additional = [];
for (const [pref, property] of prefSuggestions) {
if (SpecialPowers.getBoolPref(pref)) {
additional.push(property);
}
}
expectedSuggestions = baseExpectedSuggestions.concat(additional);
expectedSuggestions.sort();
} else {
expectedSuggestions = baseExpectedSuggestions;
}

++index;
await SpecialPowers.spawn(
browser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
" ch # The column location of the cursor",
" ],",
" suggestions # Array of expected results",
" pref-suggestions # Optional array of additional pref-enabled suggestions: [pref, suggestion]",
"]"
],
"tests": [
Expand Down Expand Up @@ -59,7 +60,8 @@
],
[
[21, 9],
["auto", "inherit", "initial", "revert", "revert-layer", "unset"]
["auto", "inherit", "initial", "revert", "revert-layer", "unset"],
[["layout.css.anchor-positioning.enabled", "anchor-size"]]
],
[
[25, 26],
Expand Down
6 changes: 5 additions & 1 deletion devtools/server/tests/chrome/test_css-properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@
ok(!cssProperties.isKnown("--foo bar"),
"A CSS variable with spaces fails");

const marginProps = ["auto", "inherit", "initial", "unset", "revert", "revert-layer"];
if(SpecialPowers.getBoolPref("layout.css.anchor-positioning.enabled")) {
marginProps.push("anchor-size");
}
is(toSortedString(cssProperties.getValues("margin")),
toSortedString(["auto", "inherit", "initial", "unset", "revert", "revert-layer"]),
toSortedString(marginProps),
"Can get values for the CSS margin.");
is(cssProperties.getValues("foobar").length, 0,
"Unknown values return an empty array.");
Expand Down
53 changes: 52 additions & 1 deletion layout/inspector/tests/test_bug877690.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,69 @@
var prop = "margin";
var values = InspectorUtils.getCSSValuesForProperty(prop);
var expected = [ "initial", "unset", "auto", "inherit", "revert", "revert-layer" ];

if(SpecialPowers.getBoolPref("layout.css.anchor-positioning.enabled")) {
expected.push("anchor-size");
}

ok(testValues(values, expected), "property margin's values.");

var prop = "inset";
var values = InspectorUtils.getCSSValuesForProperty(prop);
var expected = [ "initial", "unset", "auto", "inherit", "revert", "revert-layer" ];

if(SpecialPowers.getBoolPref("layout.css.anchor-positioning.enabled")) {
expected.push("anchor");
expected.push(...["anchor", "anchor-size"]);
}

ok(testValues(values, expected), "property inset's values.");

var prop = "width";
var values = InspectorUtils.getCSSValuesForProperty(prop);
var expected = [
"-moz-available",
"-webkit-fill-available",
"auto",
"fit-content",
"inherit",
"initial",
"max-content",
"min-content",
"revert",
"revert-layer",
"stretch",
"unset",
];

if(SpecialPowers.getBoolPref("layout.css.anchor-positioning.enabled")) {
expected.push("anchor-size");
}

ok(testValues(values, expected), "property width's values.");

var prop = "max-width";
var values = InspectorUtils.getCSSValuesForProperty(prop);
var expected = [
"-moz-available",
"-webkit-fill-available",
"none",
"fit-content",
"inherit",
"initial",
"max-content",
"min-content",
"revert",
"revert-layer",
"stretch",
"unset",
];

if(SpecialPowers.getBoolPref("layout.css.anchor-positioning.enabled")) {
expected.push("anchor-size");
}

ok(testValues(values, expected), "property max-width's values.");

// Test property with "normal"
var prop = "font-style";
var values = InspectorUtils.getCSSValuesForProperty(prop);
Expand Down
Loading

0 comments on commit d35677e

Please sign in to comment.