-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from ShellyDCMS/node-8
node 18
- Loading branch information
Showing
21 changed files
with
1,000 additions
and
995 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
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1,65 @@ | ||
export { CypressAngularComponentHelper } from "./cypress-angular-component-helper"; | ||
import type { Type } from "@angular/core"; | ||
import { ComponentFixture } from "@angular/core/testing"; | ||
import { MountConfig } from "cypress/angular"; | ||
/** | ||
* @class CypressAngularComponentHelper was designed designed for mounting angular components | ||
* @template T - component type | ||
* @classdes CypressAngularComponentHelper exposes the following public properties: | ||
* @property when - enables mounting of an Angular component | ||
* @property get - enables getting the mounted component | ||
*/ | ||
export class CypressAngularComponentHelper<T> { | ||
private fixture: any; | ||
public when = { | ||
/** | ||
* mount an angular component, with autoSpyOutputs set to true, meaning all event emitters are automatically spied on | ||
* and be accessed during a test using | ||
* ```ts | ||
* helper.get.spy("<EventEmitterName>") | ||
* ``` | ||
* @example | ||
* ```ts | ||
* helper.when.mount( | ||
* Type<AvatarComponent>, | ||
* { | ||
* declarations: [AvatarComponent], | ||
* }, | ||
* { | ||
* initials: 'JD', | ||
* picture: 'assets/avatar/def-user-male.png', | ||
* } | ||
* ) | ||
* ``` | ||
* @param componentType | ||
* @param config | ||
* @param componentProperties | ||
*/ | ||
mount: ( | ||
componentType: Type<T> | string, | ||
config: MountConfig<T>, | ||
componentProperties?: Partial<{ | ||
[P in keyof T]: T[P]; | ||
}> | ||
) => { | ||
// @ts-ignore | ||
const mountResponse = cy.mount<T>(componentType, { | ||
...config, | ||
autoSpyOutputs: true, | ||
componentProperties: { | ||
...config.componentProperties, | ||
...componentProperties | ||
} | ||
}); | ||
mountResponse.its("fixture").then((fixture: ComponentFixture<T>) => { | ||
this.fixture = fixture; | ||
}); | ||
} | ||
}; | ||
public get = { | ||
/** | ||
* Get mounted component | ||
* @returns {ComponentFixture<T>} | ||
*/ | ||
component: (): T => this.fixture.componentInstance | ||
}; | ||
} |
Oops, something went wrong.