-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Ignore proprietary
DXImageTransform.Microsoft
MS filters (#128)
- Loading branch information
Showing
4 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/stylelint-config-wordpress/__tests__/functions-invalid.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* function-name-case */ | ||
|
||
a { | ||
width: Calc(5% - 10em); | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/stylelint-config-wordpress/__tests__/functions-valid.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* function-name-case */ | ||
|
||
a { | ||
width: calc(5% - 10em); | ||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#1e8cbe", endColorstr="#0074a2", GradientType=0); | ||
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100); | ||
} |
84 changes: 84 additions & 0 deletions
84
packages/stylelint-config-wordpress/__tests__/functions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
"use strict" | ||
|
||
const fs = require("fs") | ||
const config = require("../") | ||
const stylelint = require("stylelint") | ||
|
||
const validCss = fs.readFileSync("./__tests__/functions-valid.css", "utf-8") | ||
const invalidCss = fs.readFileSync("./__tests__/functions-invalid.css", "utf-8") | ||
|
||
describe("flags no warnings with valid functions css", () => { | ||
let result | ||
|
||
beforeEach(() => { | ||
result = stylelint.lint({ | ||
code: validCss, | ||
config, | ||
}) | ||
}) | ||
|
||
it("did not error", () => { | ||
return result.then(data => ( | ||
expect(data.errored).toBeFalsy() | ||
)) | ||
}) | ||
|
||
it("flags no warnings", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings.length).toBe(0) | ||
)) | ||
}) | ||
}) | ||
|
||
describe("flags warnings with invalid functions css", () => { | ||
let result | ||
|
||
beforeEach(() => { | ||
result = stylelint.lint({ | ||
code: invalidCss, | ||
config, | ||
}) | ||
}) | ||
|
||
it("did error", () => { | ||
return result.then(data => ( | ||
expect(data.errored).toBeTruthy() | ||
)) | ||
}) | ||
|
||
it("flags three warnings", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings.length).toBe(1) | ||
)) | ||
}) | ||
|
||
it("correct first warning text", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings[0].text).toBe("Expected \"Calc\" to be \"calc\" (function-name-case)") | ||
)) | ||
}) | ||
|
||
it("correct first warning rule flagged", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings[0].rule).toBe("function-name-case") | ||
)) | ||
}) | ||
|
||
it("correct first warning severity flagged", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings[0].severity).toBe("error") | ||
)) | ||
}) | ||
|
||
it("correct first warning line number", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings[0].line).toBe(4) | ||
)) | ||
}) | ||
|
||
it("correct first warning column number", () => { | ||
return result.then(data => ( | ||
expect(data.results[0].warnings[0].column).toBe(9) | ||
)) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters