-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow unknown custom media queries (#4)
Resolves #3
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
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
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
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,43 @@ | ||
import { testRule } from "../utils/testRule.js" | ||
|
||
let rule = `no-unknown-custom-media` | ||
|
||
let code = ` | ||
@custom-media --any-valid (width >= 40rem); | ||
@media (--any-valid), (height < 40rem) {} | ||
@media (--another-valid) {} | ||
@custom-media --another-valid (width >= 60rem); | ||
@media (--invalid) {} | ||
@media (--invalid), (height < 40rem) {} | ||
` | ||
|
||
testRule({ | ||
description: `Custom media queries should be known`, | ||
rule, | ||
code, | ||
expectedWarnings: [ | ||
{ | ||
line: 10, | ||
column: 9, | ||
endLine: 10, | ||
endColumn: 18, | ||
rule, | ||
severity: `error`, | ||
text: `Unexpected unknown custom media "--invalid" (${rule})`, | ||
}, | ||
{ | ||
line: 12, | ||
column: 9, | ||
endLine: 12, | ||
endColumn: 18, | ||
rule, | ||
severity: `error`, | ||
text: `Unexpected unknown custom media "--invalid" (${rule})`, | ||
}, | ||
], | ||
}) |