Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CSS Conditional Level 5 #456

Merged
merged 2 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@
"seriesComposition": "delta",
"shortTitle": "CSS Conditional 4"
},
{
"url": "https://www.w3.org/TR/css-conditional-5/",
"seriesComposition": "delta",
"shortTitle": "CSS Conditional 5"
},
"https://www.w3.org/TR/css-contain-2/",
"https://www.w3.org/TR/css-content-3/",
"https://www.w3.org/TR/css-counter-styles-3/",
Expand Down
15 changes: 8 additions & 7 deletions test/specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,15 @@ describe("Input list", () => {
});

it("does not have a delta spec without a previous full spec", () => {
// Note the tetst considers that a delta spec of a delta spec is an error
// too. That case could perhaps happen in practice and the "seriesPrevious"
// chain can easily be followed to find the previous level that contains the
// "full" spec. Still, it seems good to choke on it as long as that's not
// needed.
const fullPrevious = (spec, list) => {
const previous = list.find(s => s.shortname === spec.seriesPrevious);
if (previous && previous.seriesComposition === "delta") {
return fullPrevious(previous, list);
}
return previous;
};
const deltaWithoutFull = specs2LinkedList(specs)
.filter((s, _, list) => s.seriesComposition === "delta" &&
!list.find(p => p.seriesComposition !== "delta" && p.shortname === s.seriesPrevious));
.filter((s, _, list) => s.seriesComposition === "delta" && !fullPrevious(s, list));
assert.strictEqual(deltaWithoutFull[0], undefined);
});

Expand Down