ComponentFixture

Stable Class

Class Overview

class ComponentFixture {
  constructor(componentRef: ComponentRef<T>, ngZone: NgZone, _autoDetect: boolean)
  
  
  debugElement : DebugElement
  componentInstance : T
  nativeElement : any
  elementRef : ElementRef
  changeDetectorRef : ChangeDetectorRef
  componentRef : ComponentRef<T>
  ngZone : NgZone
  detectChanges(checkNoChanges?: boolean) : void
  checkNoChanges() : void
  autoDetectChanges(autoDetect?: boolean)
  isStable() : boolean
  whenStable() : Promise<any>
  destroy() : void
}

Class Description

Fixture for debugging and testing a component.

Constructor

constructor(componentRef: ComponentRef<T>, ngZone: NgZone, _autoDetect: boolean)

Class Details

debugElement : DebugElement

The DebugElement associated with the root element of this component.

componentInstance : T

The instance of the root component class.

nativeElement : any

The native element at the root of the component.

elementRef : ElementRef

The ElementRef for the element at the root of the component.

changeDetectorRef : ChangeDetectorRef

The ChangeDetectorRef for the component

componentRef : ComponentRef<T>
ngZone : NgZone
detectChanges(checkNoChanges?: boolean) : void

Trigger a change detection cycle for the component.

checkNoChanges() : void

Do a change detection run to make sure there were no changes.

autoDetectChanges(autoDetect?: boolean)

Set whether the fixture should autodetect changes.

Also runs detectChanges once so that any existing change is detected.

isStable() : boolean

Return whether the fixture is currently stable or has async tasks that have not been completed yet.

whenStable() : Promise<any>

Get a promise that resolves when the fixture is stable.

This can be used to resume testing after events have triggered asynchronous activity or asynchronous change detection.

destroy() : void

Trigger component destruction.

exported from @angular/core/testing/index, defined in @angular/core/testing/component_fixture.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/core/testing/index/ComponentFixture-class.html