import { ComponentFixture , TestBed } from '@angular/core/testing' ; import { DebugElement , Type } from '@angular/core' ; import { TestTextArea } from './test-textarea' ; import { TestElement } from './test-element' ; import { TestInput } from './test-input' ; import { TestSelect } from './test-select' ; import { TestButton } from './test-button' ; import { TestElementQuerier } from './test-element-querier' ; import { TestHtmlElement } from './test-html-element' ; param export class ComponentTester < C > { /**
     * The test element of the component
     */ readonly testElement : TestElement < HTMLElement > ; /**
     * The component fixture of the component
     */ readonly fixture : ComponentFixture < C > ; /**
     * Creates a component fixture of the given type with the TestBed and wraps it into a ComponentTester
     */ static create < C > ( componentType ) { const fixture = TestBed . createComponent ( componentType ) ; return new ComponentTester ( fixture ) ; } param arg constructor ( arg ) { this . fixture = arg instanceof ComponentFixture ? arg : TestBed . createComponent ( arg ) ; this . testElement = TestElementQuerier . wrap ( this . debugElement , this ) as TestElement < HTMLElement > ; } /**
     * The native DOM host element of the component
     */ get nativeElement ( ) : HTMLElement { return this . fixture . nativeElement ; } /**
     * Gets the instance of the tested component from the wrapped fixture
     */ get componentInstance ( ) : C { return this . fixture . componentInstance ; } /**
     * Gets the debug element from the wrapped fixture
     */ get debugElement ( ) : DebugElement { return this . fixture . debugElement ; } param selector returns element < K extends keyof HTMLElementTagNameMap > ( selector ) ; param selector returns element < K extends keyof SVGElementTagNameMap > ( selector ) ; param selector returns element ( selector ) ; param selector returns element < T extends HTMLInputElement > ( selector ) ; param selector returns element < T extends HTMLTextAreaElement > ( selector ) ; param selector returns element < T extends HTMLSelectElement > ( selector ) ; param selector returns element < T extends HTMLButtonElement > ( selector ) ; param selector returns element < T extends HTMLElement > ( selector ) ; param selector returns element < T extends Element > ( selector ) ; element ( selector ) { return this . testElement . element ( selector ) ; } param selector returns elements < K extends keyof HTMLElementTagNameMap > ( selector ) ; param selector returns elements < K extends keyof SVGElementTagNameMap > ( selector ) ; param selector returns elements ( selector ) ; param selector returns elements < T extends HTMLInputElement > ( selector ) ; param selector returns elements < T extends HTMLTextAreaElement > ( selector ) ; param selector returns elements < T extends HTMLButtonElement > ( selector ) ; param selector returns elements < T extends HTMLSelectElement > ( selector ) ; param selector returns elements < T extends HTMLElement > ( selector ) ; param selector returns elements < T extends Element > ( selector ) ; elements ( selector ) { return this . testElement . elements ( selector ) ; } param selector returns input ( selector ) { return this . testElement . input ( selector ) ; } param selector returns select ( selector ) { return this . testElement . select ( selector ) ; } param selector returns throws textarea ( selector ) { return this . testElement . textarea ( selector ) ; } param selector returns button ( selector ) { return this . testElement . button ( selector ) ; } /**
     * Triggers a change detection using the wrapped fixture
     */ detectChanges ( checkNoChanges ? ) { this . fixture . detectChanges ( checkNoChanges ) ; } }