fix(core): fix pseudo-selector shimming (#12754)

fixes #12730
fixes #12354
This commit is contained in:
Victor Berchet
2016-11-07 13:56:04 -08:00
committed by vikerman
parent f3793b5953
commit acbf1d859c
2 changed files with 52 additions and 17 deletions

View File

@ -140,9 +140,15 @@ export function main() {
.toEqual('[a="b"][a-host], [c="d"][a-host] {}');
});
it('should handle pseudo selector', () => {
it('should handle pseudo selectors', () => {
expect(s(':host(:before) {}', 'a', 'a-host')).toEqual('[a-host]:before {}');
expect(s(':host:before {}', 'a', 'a-host')).toEqual('[a-host]:before {}');
expect(s(':host:nth-child(8n+1) {}', 'a', 'a-host')).toEqual('[a-host]:nth-child(8n+1) {}');
expect(s(':host:nth-of-type(8n+1) {}', 'a', 'a-host'))
.toEqual('[a-host]:nth-of-type(8n+1) {}');
expect(s(':host(.class):before {}', 'a', 'a-host')).toEqual('.class[a-host]:before {}');
expect(s(':host.class:before {}', 'a', 'a-host')).toEqual('.class[a-host]:before {}');
expect(s(':host(:not(p)):before {}', 'a', 'a-host')).toEqual('[a-host]:not(p):before {}');
});
});