-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(component-tester): fix bug where @containerless components wouldn…
…'t be initialized properly, this breaks the ability to manually call detached() lifecycle methods on the component for the time-being however (#12) Fixes #11
- Loading branch information
1 parent
ab24fe9
commit 7a8b69e
Showing
4 changed files
with
38 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { PLATFORM } from 'aurelia-framework'; | ||
import { bootstrap } from 'aurelia-bootstrapper'; | ||
import { StageComponent } from 'cypress-aurelia-unit-test'; | ||
|
||
import { ContainerlessDiv } from '~/containerless-div/containerless-div'; | ||
|
||
describe('ContainerlessDiv', () => { | ||
it('Test that we properly render a containerless component and calls attached() once', () => { | ||
const component = StageComponent | ||
.withResources<ContainerlessDiv>(PLATFORM.moduleName('containerless-div/containerless-div')) | ||
.inView(`<containerless-div></containerless-div>`); | ||
component.create(bootstrap); | ||
cy.get('containerless-div').should('not.exist'); | ||
const AttachedMethodCalledCount = '1'; | ||
cy.get(`div`).contains(AttachedMethodCalledCount); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div textcontent.bind="attachedCounter"></div> | ||
</template> |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { autoinject, containerless } from 'aurelia-framework'; | ||
|
||
@autoinject | ||
@containerless | ||
export class ContainerlessDiv { | ||
protected attachedCounter = 0; | ||
|
||
protected attached(): void { | ||
this.attachedCounter += 1; | ||
} | ||
} |