-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support to assert styles on selectors (hover, active) and m…
…edia queries (#168) * Remove double nesting for matching compiled css * Add media and state for asserting styles. * Fix TS error * Duplicate as TS is erroring * Add css module * Refactor matching logic to work on ast with rules. * Add test for state and media * Move @types/css to dev dependencies * Improve tests a bit * Use `Pseudo` for awesome TS intellisense Rename state -> target. * Add support for nested media querie assertions * Complex direct descendents etc work now. * Make intellisense work again, thanks @Madou
- Loading branch information
1 parent
72e72e5
commit b38c0d8
Showing
6 changed files
with
228 additions
and
12 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
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,14 @@ | ||
import { Pseudos } from 'csstype'; | ||
|
||
/** | ||
* {} is used to enabled the compiler to not reduce Target down to a string. | ||
* This keeps both Pseduos intellisense working as well as then allowing us to define anything. | ||
* See: https://github.com/microsoft/TypeScript/issues/29729#issuecomment-460346421 | ||
*/ | ||
type AnyTarget = string & { _?: never }; | ||
type Target = Pseudos | AnyTarget; | ||
|
||
export interface MatchFilter { | ||
target?: Target; | ||
media?: string; | ||
} |
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