test(Selector): add a test for dotted attribute names

This commit is contained in:
Victor Berchet 2016-12-09 14:39:18 -08:00
parent 04cfa1ebdf
commit 95f48292b1
1 changed files with 11 additions and 0 deletions

View File

@ -102,6 +102,17 @@ export function main() {
expect(matched).toEqual([s1[0], 1, s2[0], 2]);
});
it('should support "." in attribute names', () => {
matcher.addSelectables(s1 = CssSelector.parse('[foo.bar]'), 1);
expect(matcher.match(CssSelector.parse('[barfoo]')[0], selectableCollector)).toEqual(false);
expect(matched).toEqual([]);
reset();
expect(matcher.match(CssSelector.parse('[foo.bar]')[0], selectableCollector)).toEqual(true);
expect(matched).toEqual([s1[0], 1]);
});
it('should select by attr name only once if the value is from the DOM', () => {
matcher.addSelectables(s1 = CssSelector.parse('[some-decor]'), 1);