Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into browser-bundle
* master: Update CHANGELOG.md Fix false negatives for where, is, nth-child and nth-last-child in selector-max-* (except selector-max-type) (#4842) Bump @types/lodash from 4.14.155 to 4.14.157 (#4869) Remove `postcss-reporter` package (#4858) Bump lodash from 4.17.15 to 4.17.19 (#4864) Replace 3rd-party type definitions (#4857)
- Loading branch information
Showing
31 changed files
with
270 additions
and
244 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
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
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
48 changes: 48 additions & 0 deletions
48
lib/utils/__tests__/isContextFunctionalPseudoClass.test.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,48 @@ | ||
'use strict'; | ||
|
||
const isContextFunctionalPseudoClass = require('../isContextFunctionalPseudoClass'); | ||
const parseSelector = require('postcss-selector-parser'); | ||
const postcss = require('postcss'); | ||
|
||
function selector(css, cb) { | ||
postcss.parse(css).walkRules((rule) => { | ||
parseSelector((selectorAST) => { | ||
selectorAST.walkPseudos(cb); | ||
}).processSync(rule.selector); | ||
}); | ||
} | ||
|
||
describe('isContextFunctionalPseudoClass', () => { | ||
it('handles non-context-functional pseudo-classes, like hover', () => { | ||
selector('a:hover {}', (selector) => { | ||
expect(isContextFunctionalPseudoClass(selector)).toBe(false); | ||
}); | ||
}); | ||
|
||
it('handles logical combinations, ', () => { | ||
selector('a:has(.foo) {}', (selector) => { | ||
expect(isContextFunctionalPseudoClass(selector)).toBe(true); | ||
}); | ||
selector('a:is(.foo) {}', (selector) => { | ||
expect(isContextFunctionalPseudoClass(selector)).toBe(true); | ||
}); | ||
selector('a:matches(.foo) {}', (selector) => { | ||
expect(isContextFunctionalPseudoClass(selector)).toBe(true); | ||
}); | ||
selector('a:not(.foo) {}', (selector) => { | ||
expect(isContextFunctionalPseudoClass(selector)).toBe(true); | ||
}); | ||
selector('a:where(.foo) {}', (selector) => { | ||
expect(isContextFunctionalPseudoClass(selector)).toBe(true); | ||
}); | ||
}); | ||
|
||
it('handles tree structural/NPlusBOfSNotationPseudoClasses classes', () => { | ||
selector('a:nth-child(n+7) {}', (selector) => { | ||
expect(isContextFunctionalPseudoClass(selector)).toBe(true); | ||
}); | ||
selector('a:nth-last-child(n+7) {}', (selector) => { | ||
expect(isContextFunctionalPseudoClass(selector)).toBe(true); | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.