fix(ivy): take styles extracted from template into account in JIT mode (#34017)
Prior to this commit, all styles extracted from Component's template (defined using <style> tags) were ignored by JIT compiler, so only `styles` array values defined in @Component decorator were used. This change updates JIT compiler to take styles extracted from the template into account. It also ensures correct order where `styles` array values are applied first and template styles are applied second. PR Close #34017
This commit is contained in:

committed by
Matias Niemelä

parent
d655093123
commit
5de7960f01
@ -5155,13 +5155,16 @@ export const Foo = Foo__PRE_R3__;
|
||||
@Component({
|
||||
selector: 'test',
|
||||
template: '<style>h1 {font-size: larger}</style>',
|
||||
styles: ['h2 {width: 10px}']
|
||||
})
|
||||
export class TestCmp {}
|
||||
`);
|
||||
|
||||
env.driveMain();
|
||||
const jsContents = env.getContents('test.js');
|
||||
expect(jsContents).toContain('styles: ["h1[_ngcontent-%COMP%] {font-size: larger}"]');
|
||||
expect(jsContents)
|
||||
.toContain(
|
||||
'styles: ["h2[_ngcontent-%COMP%] {width: 10px}", "h1[_ngcontent-%COMP%] {font-size: larger}"]');
|
||||
});
|
||||
|
||||
it('should process inline <link> tags', () => {
|
||||
|
Reference in New Issue
Block a user