Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
22 changes: 22 additions & 0 deletions test/css/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ describe(`The curated view of CSS extracts`, async () => {
assert.equal(results.length, 0, writeAnomalies(results));
});

// Collect all property names across all specs for longhands validation
const allPropertyNames = new Set();
for (const data of Object.values(all)) {
for (const prop of data.properties) {
allPropertyNames.add(prop.name);
}
}

for (const [shortname, data] of Object.entries(all)) {
describe(`The CSS extract for ${shortname} in the curated view`, () => {
it('contains a link to the underlying spec', async () => {
Expand Down Expand Up @@ -121,6 +129,20 @@ describe(`The curated view of CSS extracts`, async () => {
}
}
}

// Validate that all longhands in shorthand properties exist
for (const prop of data.properties) {
if (prop.longhands && Array.isArray(prop.longhands)) {
for (const longhand of prop.longhands) {
it(`has valid longhand "${longhand}" for shorthand "${prop.name}"`, () => {
assert(
allPropertyNames.has(longhand),
`Longhand "${longhand}" for shorthand "${prop.name}" does not exist in any CSS extract`
);
});
}
}
}
});
}
});
Loading