This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow to remove lifecycle listeners
- Loading branch information
1 parent
f884ba4
commit 659bee1
Showing
2 changed files
with
42 additions
and
1 deletion.
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,32 @@ | ||
// tslint:disable: no-implicit-dependencies | ||
import { assert } from 'chai'; | ||
import { TSDI, component } from '..'; | ||
|
||
describe('TSDI', () => { | ||
let tsdi: TSDI; | ||
|
||
beforeEach(() => { | ||
tsdi = new TSDI(); | ||
}); | ||
|
||
afterEach(() => { | ||
tsdi.close(); | ||
}); | ||
it('should allow to remove lifecycle listeners', () => { | ||
@component | ||
class Component {} | ||
tsdi.register(Component); | ||
|
||
const removeLifecycleListener = tsdi.addLifecycleListener({ | ||
onCreate(comp: any): void { | ||
if (comp instanceof Component) { | ||
assert.fail(); | ||
} | ||
}, | ||
}); | ||
|
||
removeLifecycleListener(); | ||
|
||
tsdi.get(Component); | ||
}); | ||
}); |
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