Last active
October 21, 2016 05:21
-
-
Save psamsotha/0bdbeb79bd08bac0e1b9e09e6e4d05a5 to your computer and use it in GitHub Desktop.
Stack Overflow http://stackoverflow.com/q/40166854/2587435
This file contains hidden or 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
| @Component({ | |
| selector: 'p-dataTable', | |
| template: `...` | |
| }) | |
| class MockDataTable { | |
| @Input() value; | |
| @Input() selection; | |
| @Output() selectionChange = new EventEmitter(); | |
| } | |
| @Component({ | |
| selector: 'table-component', | |
| template: '<p-dataTable #table></p-dataTable>' | |
| }) | |
| class MyTable { | |
| @ViewChild('table') table; | |
| } | |
| @Component({ | |
| template: ` | |
| <table-component #myTable></table-component> | |
| ` | |
| }) | |
| class TestComponent { | |
| @ViewChild('myTable') table; | |
| } | |
| describe('component: TestComponent', () => { | |
| beforeEach(() => { | |
| TestBed.configureTestingModule({ | |
| imports: [ ReactiveFormsModule ], | |
| declarations: [ TestComponent, MyTable, MockDataTable ] | |
| }); | |
| }); | |
| it('should find elements', async(() => { | |
| let fixture = TestBed.createComponent(TestComponent); | |
| let component = fixture.componentInstance; | |
| fixture.detectChanges(); | |
| console.log(`DATATABLE: ${component.table.table}`); | |
| })); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment