fix(ivy): static host classes and styles should work on root component (#28926)

PR Close #28926
This commit is contained in:
Marc Laval
2019-02-22 17:44:58 +01:00
committed by Ben Lesh
parent 8f8f9a6e61
commit dc9f0af080
5 changed files with 43 additions and 40 deletions

View File

@ -97,4 +97,18 @@ describe('acceptance integration tests', () => {
expect(subInstance.dirs.first).toBeAnInstanceOf(SomeDir);
});
it('should render host class and style on the root component', () => {
@Component({template: '...', host: {class: 'foo', style: 'color: red'}})
class MyApp {
}
TestBed.configureTestingModule({declarations: [MyApp]});
const fixture = TestBed.createComponent(MyApp);
const element = fixture.nativeElement;
fixture.detectChanges();
expect(element.style['color']).toEqual('red');
expect(element.classList.contains('foo')).toBeTruthy();
});
});