Skip to content

Commit 5d78840

Browse files
committed
test: css validation unit tests
1 parent b79317d commit 5d78840

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/test-css.worker.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe(`web worker CSS Language tests`, async function () {
8080
* - "vendorPrefix": Warns on missing vendor prefixes.
8181
* - "universalSelector": Warns against the use of the universal selector (*).
8282
* - "hexColorLength": Enforces consistency in hex color definitions.
83-
* - "argumentsInColorFunction": Validates arguments within color functions.
83+
* - "argumentsInColorFunction": Validates arguments within color functions. -- this doesnt work/vscode bug likely
8484
* - "float": Advises on the use of `float`, recommending modern layout alternatives.
8585
* - "idSelector": Advises against using ID selectors for styling.
8686
*/
@@ -101,6 +101,22 @@ describe(`web worker CSS Language tests`, async function () {
101101
* important: none
102102
*/
103103

104+
it("should validate css argumentsInColorFunction", async function () {
105+
const cssValidationData = await (await fetch("test-files/cssValidationData.json")).json();
106+
messageFromWorker = null;
107+
const text = `div {
108+
background-color: rgba ( 10,20,30,40,50);
109+
}`;
110+
worker.postMessage({
111+
command: `validateCSS`, text, cssMode: "CSS", filePath: "file:///c.css", lintSettings: {
112+
argumentsInColorFunction: "warning"
113+
}
114+
});
115+
let output = await waitForWorkerMessage(`validateCSS`, 1000);
116+
const symbols = output.diag;
117+
expect(symbols).to.deep.equal(cssValidationData["argumentsInColorFunction"]);
118+
});
119+
104120
it("should validate css unknownVendorSpecificProperties", async function () {
105121
const cssValidationData = await (await fetch("test-files/cssValidationData.json")).json();
106122
messageFromWorker = null;

0 commit comments

Comments
 (0)