fix(compiler): fix corner cases in shadow CSS
`cmp:host {}` and `cmp:host some-other-selector {}` were not handled consistently. Note those should not match anything but are made equivalent to respectively `:host(cmp)` and `:host(cmp) some-other-selector` to avoid breaking legacy apps.
This commit is contained in:
@ -150,6 +150,18 @@ export function main() {
|
||||
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 {}');
|
||||
});
|
||||
|
||||
// see b/63672152
|
||||
it('should handle unexpected selectors in the most reasonable way', () => {
|
||||
expect(s('cmp:host {}', 'a', 'a-host')).toEqual('cmp[a-host] {}');
|
||||
expect(s('cmp:host >>> {}', 'a', 'a-host')).toEqual('cmp[a-host] {}');
|
||||
expect(s('cmp:host child {}', 'a', 'a-host')).toEqual('cmp[a-host] child[a] {}');
|
||||
expect(s('cmp:host >>> child {}', 'a', 'a-host')).toEqual('cmp[a-host] child {}');
|
||||
expect(s('cmp :host {}', 'a', 'a-host')).toEqual('cmp [a-host] {}');
|
||||
expect(s('cmp :host >>> {}', 'a', 'a-host')).toEqual('cmp [a-host] {}');
|
||||
expect(s('cmp :host child {}', 'a', 'a-host')).toEqual('cmp [a-host] child[a] {}');
|
||||
expect(s('cmp :host >>> child {}', 'a', 'a-host')).toEqual('cmp [a-host] child {}');
|
||||
});
|
||||
});
|
||||
|
||||
describe((':host-context'), () => {
|
||||
|
Reference in New Issue
Block a user