feat(compiler): add support ::ng-deep

- /deep/ is deprecated and being removed from Chrome
- >>> is semantically invalid in a stylesheet
- sass will no longer support either in any version of sass

-> use ::ng-deep in emulated shadow DOM mode

Because the deep combinator is deprecated in the CSS spec,
`/deep/`, `>>>` and `::ng-deep` are also deprecated in emulated shadow DOM mode
and will be removed in the future.

see https://www.chromestatus.com/features/6750456638341120
This commit is contained in:
Victor Berchet
2017-06-21 16:53:37 -07:00
committed by Matias Niemelä
parent 81734cf7b6
commit b754e600e3
3 changed files with 32 additions and 7 deletions

View File

@ -231,6 +231,19 @@ export function main() {
expect(css).toEqual('x[a] y {}');
});
it('should handle ::ng-deep', () => {
let css = '::ng-deep y {}';
expect(s(css, 'a')).toEqual('y {}');
css = 'x ::ng-deep y {}';
expect(s(css, 'a')).toEqual('x[a] y {}');
css = ':host > ::ng-deep .x {}';
expect(s(css, 'a', 'h')).toEqual('[h] > .x {}');
css = ':host ::ng-deep > .x {}';
expect(s(css, 'a', 'h')).toEqual('[h] > .x {}');
css = ':host > ::ng-deep > .x {}';
expect(s(css, 'a', 'h')).toEqual('[h] > > .x {}');
});
it('should pass through @import directives', () => {
const styleStr = '@import url("https://fonts.googleapis.com/css?family=Roboto");';
const css = s(styleStr, 'a');