Skip to content

@shellygo/cypress-test-utils - v4.1.10 / Modules / CypressAngularComponentHelper

Class: CypressAngularComponentHelper<T>

Classdes

CypressAngularComponentHelper exposes the following public properties:

Type parameters

Name Description
T component type

Table of contents

Constructors

Properties

Constructors

constructor

new CypressAngularComponentHelper<T>()

Type parameters

Name
T

Properties

get

get: Object

enables getting the mounted component

Type declaration

Name Type
component () => T

component: () => T

Get mounted component



when

when: Object

enables mounting of an Angular component

Type declaration

Name Type
mount (component: string | Type<T>, config: MountConfig<T>, props?: Partial<{ [P in string | number | symbol]: T[P] }>) => PromiseLike<ComponentFixture<T>>

mount: (component: string | Type<T>, config: MountConfig<T>, props?: Partial<{ [P in string | number | symbol]: T[P] }>) => PromiseLike<ComponentFixture<T>>

mount an angular component, with autoSpyOutputs set to true, meaning all event emitters are automatically spied on and be accessed during a test using

helper.get.spy("<EventEmitterName>")

Example

helper.when.mount(
 Type<AvatarComponent>,
 {
   declarations: [AvatarComponent],
 },
 {
   initials: 'JD',
   picture: 'assets/avatar/def-user-male.png',
 }
)