refactor(core): move Meta methods that only have one version from DomAdapter (#32408)

PR Close #32408
This commit is contained in:
Kara Erickson
2019-08-30 12:52:48 -07:00
committed by Miško Hevery
parent 1a7c79746d
commit 89434e09c2
28 changed files with 88 additions and 111 deletions

View File

@ -114,12 +114,12 @@ function declareTests(config?: {useJit: boolean}) {
fixture.componentInstance.ctxProp = 'Initial aria label';
fixture.detectChanges();
expect(getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'aria-label'))
expect(fixture.debugElement.children[0].nativeElement.getAttribute('aria-label'))
.toEqual('Initial aria label');
fixture.componentInstance.ctxProp = 'Changed aria label';
fixture.detectChanges();
expect(getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'aria-label'))
expect(fixture.debugElement.children[0].nativeElement.getAttribute('aria-label'))
.toEqual('Changed aria label');
});
@ -131,8 +131,7 @@ function declareTests(config?: {useJit: boolean}) {
fixture.componentInstance.ctxProp = 'bar';
fixture.detectChanges();
expect(getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'foo'))
.toEqual('bar');
expect(fixture.debugElement.children[0].nativeElement.getAttribute('foo')).toEqual('bar');
fixture.componentInstance.ctxProp = null !;
fixture.detectChanges();
@ -887,7 +886,7 @@ function declareTests(config?: {useJit: boolean}) {
fixture.detectChanges();
expect(getDOM().getAttribute(fixture.debugElement.nativeElement, 'role')).toEqual('button');
expect(fixture.debugElement.nativeElement.getAttribute('role')).toEqual('button');
});
it('should support updating host element via hostAttributes on host elements', () => {
@ -898,7 +897,7 @@ function declareTests(config?: {useJit: boolean}) {
fixture.detectChanges();
expect(getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'role'))
expect(fixture.debugElement.children[0].nativeElement.getAttribute('role'))
.toEqual('button');
});
@ -1404,7 +1403,7 @@ function declareTests(config?: {useJit: boolean}) {
TestBed.overrideComponent(MyComp, {set: {template}});
const fixture = TestBed.createComponent(MyComp);
expect(getDOM().querySelectorAll(fixture.nativeElement, 'script').length).toEqual(0);
expect(fixture.nativeElement.querySelectorAll('script').length).toEqual(0);
});
it('should throw when using directives without selector in NgModule declarations', () => {
@ -2139,7 +2138,7 @@ class SimpleImperativeViewComponent {
constructor(self: ElementRef) {
const hostElement = self.nativeElement;
getDOM().appendChild(hostElement, el('hello imp view'));
hostElement.appendChild(el('hello imp view'));
}
}
@ -2663,7 +2662,7 @@ class SomeImperativeViewport {
this.view = this.vc.createEmbeddedView(this.templateRef);
const nodes = this.view.rootNodes;
for (let i = 0; i < nodes.length; i++) {
getDOM().appendChild(this.anchor, nodes[i]);
this.anchor.appendChild(nodes[i]);
}
}
}