fix(ivy): proper resolution of Enums in Component decorator (#27971)
Prior to this change Component decorator was resolving `encapsulation` value a bit incorrectly, which resulted in `encapsulation: NaN` in compiled code. Now we resolve the value as Enum memeber and throw if it's not the case. As a part of this update, the `changeDetection` field handling is also added, the resolution logic is the same as the one used for `encapsulation` field. PR Close #27971
This commit is contained in:
@ -50,11 +50,11 @@ describe('compiler compliance: styling', () => {
|
||||
const files = {
|
||||
app: {
|
||||
'spec.ts': `
|
||||
import {Component, NgModule} from '@angular/core';
|
||||
import {Component, NgModule, ViewEncapsulation} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: "my-component",
|
||||
encapsulation: ${ViewEncapsulation.None},
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
styles: ["div.tall { height: 123px; }", ":host.small p { height:5px; }"],
|
||||
template: "..."
|
||||
})
|
||||
@ -77,10 +77,10 @@ describe('compiler compliance: styling', () => {
|
||||
const files = {
|
||||
app: {
|
||||
'spec.ts': `
|
||||
import {Component, NgModule} from '@angular/core';
|
||||
import {Component, NgModule, ViewEncapsulation} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
encapsulation: ${ViewEncapsulation.Native},
|
||||
encapsulation: ViewEncapsulation.Native,
|
||||
selector: "my-component",
|
||||
styles: ["div.cool { color: blue; }", ":host.nice p { color: gold; }"],
|
||||
template: "..."
|
||||
|
Reference in New Issue
Block a user