fix(selector): SelectorMatcher match elements with :not selector (#12977)

This commit is contained in:
Dzmitry Shylovich
2016-12-09 21:45:48 +03:00
committed by Victor Berchet
parent f0b0762f4a
commit 9a8423da36
2 changed files with 8 additions and 3 deletions

View File

@ -223,6 +223,11 @@ export function main() {
expect(matched).toEqual([s1[0], 1, s2[0], 2, s3[0], 3, s4[0], 4]);
});
it('should match * with :not selector', () => {
matcher.addSelectables(CssSelector.parse(':not([a])'), 1);
expect(matcher.match(CssSelector.parse('div')[0], () => {})).toEqual(true);
});
it('should match with multiple :not selectors', () => {
matcher.addSelectables(s1 = CssSelector.parse('div:not([a]):not([b])'), 1);
expect(matcher.match(CssSelector.parse('div[a]')[0], selectableCollector)).toBe(false);