-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): add entry component example with Ivy (#663)
- Loading branch information
Showing
11 changed files
with
78 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
e2e/test-app-v10/src/app/dynamic-component/dynamic-button.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-dynamic-button', | ||
template: ` | ||
<button (click)="onClick()"> | ||
Hello | ||
</button> | ||
`, | ||
}) | ||
export class DynamicButtonComponent { | ||
onClick() { | ||
console.log('Click!'); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
e2e/test-app-v10/src/app/dynamic-component/dynamic-host.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { By } from '@angular/platform-browser'; | ||
import { DynamicHostComponent } from './dynamic-host.component'; | ||
import { DynamicHostModule } from './dynamic-host.module'; | ||
|
||
describe('Dynamic components', () => { | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ DynamicHostModule ], | ||
}); | ||
}); | ||
|
||
it('dynamically renders a button', async () => { | ||
const fixture = TestBed.createComponent(DynamicHostComponent); | ||
fixture.detectChanges(); | ||
const button = fixture.debugElement.query(By.css('button')).nativeElement as HTMLButtonElement; | ||
expect(button.textContent).toContain('Hello'); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
e2e/test-app-v10/src/app/dynamic-component/dynamic-host.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Component } from '@angular/core'; | ||
import { DynamicButtonComponent } from './dynamic-button.component'; | ||
|
||
@Component({ | ||
selector: 'app-dynamic-host', | ||
template: ` | ||
<ng-container [ngComponentOutlet]="dynamicComponentType"></ng-container> | ||
`, | ||
}) | ||
export class DynamicHostComponent { | ||
dynamicComponentType = DynamicButtonComponent; | ||
} |
10 changes: 10 additions & 0 deletions
10
e2e/test-app-v10/src/app/dynamic-component/dynamic-host.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { DynamicHostComponent } from './dynamic-host.component'; | ||
|
||
@NgModule({ | ||
declarations: [DynamicHostComponent], | ||
exports: [DynamicHostComponent], | ||
imports: [CommonModule], | ||
}) | ||
export class DynamicHostModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters