Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(spectator): Support input signals (#638)
* feat(spectator): wip implementation for input signals support * feat: support input signals BREAKING CHANGE: remove 'props' and 'setProps' from host/directive factories * fix: infer input signals when setting inputs on createComponent * test: align signal input test between jasmine/jest * refactor: rename input signal types to be aligned Fixed type names of InferSignalInputs and InputSignalInput (which was a typo) to be aligned with Angular's InputSignal type, rather than SignalInput * refactor: remove unnecessary generic params from factories * fix: setprops behaviour for pipe factory * docs: update documentation to reflect api Changes Added disclaimers for createHostFactory, createDirectiveFactory, and createPipeFactory as they don't support props/setProps anymore.
- Loading branch information
Showing
39 changed files
with
1,701 additions
and
1,471 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
40 changes: 40 additions & 0 deletions
40
projects/spectator/jest/test/signal-input/signal-input.component.spec.ts
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,40 @@ | ||
import { createComponentFactory, createHostFactory, Spectator, SpectatorHost } from '@ngneat/spectator/jest'; | ||
import { SignalInputComponent } from '../../../test/signal-input/signal-input.component'; | ||
|
||
describe('SignalInputComponent', () => { | ||
describe('with Spectator', () => { | ||
let spectator: Spectator<SignalInputComponent>; | ||
|
||
const createComponent = createComponentFactory({ | ||
component: SignalInputComponent, | ||
}); | ||
|
||
beforeEach(() => { | ||
spectator = createComponent({ props: { show: true } }); | ||
}); | ||
|
||
it('should render a SignalInputComponent', () => { | ||
expect(spectator.query('#text')).toContainText('Hello'); | ||
}); | ||
}); | ||
|
||
describe('with SpectatorHost', () => { | ||
let host: SpectatorHost<SignalInputComponent>; | ||
|
||
const createHost = createHostFactory({ | ||
component: SignalInputComponent, | ||
shallow: true, | ||
template: `<div><app-signal-input [show]="show"></app-signal-input></div>`, | ||
}); | ||
|
||
beforeEach(() => { | ||
host = createHost(); | ||
}); | ||
|
||
it('should render a SignalInputComponent', () => { | ||
expect(host.query('#text')).not.toExist(); | ||
host.setHostInput({ show: true }); | ||
expect(host.query('#text')).toContainText('Hello'); | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.