-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: input.required signals cannot be set in TestBed #2370
Comments
Found this workaround in stack overflow:
|
Does not work for me in 14.1.0 |
@markusahrweileramcon we added example at jest-preset-angular/examples/example-app-v17/src/app/dashboard/dashboard-hero.component.ts Line 22 in c1e3ad7
Oh I might miss the context, look like it's not the issue of this repo but rather than the issue of |
Actually it works in the test via this line jest-preset-angular/examples/example-app-v17/src/app/dashboard/dashboard-hero.component.spec.ts Line 31 in c1e3ad7
|
oh, my ... the issue was, that I've set the input in the tests itself and called |
Version
14.0.3
Steps to reproduce
In your component, declare a required input signal:
and try to set it in the accompanying component.spec.ts:
Tests then fail with
Can't set value of the 'data' input on the 'MyComponent' component
.If I change the input signal to not be required (i.e. just
data = input<MyData>();
) then the tests succeed.Expected behavior
Tests should work ;)
Actual behavior
Additional context
Support for input signals was added in #2246
Using non-required signal input works, only the
input.required
signal fails.Environment
$ npx envinfo --preset jest System: OS: Linux 6.7 Fedora Linux 39 (Workstation Edition) CPU: (24) x64 AMD Ryzen 9 7900X 12-Core Processor Binaries: Node: 20.12.0 - /usr/bin/node npm: 10.5.0 - /usr/bin/npm npmPackages: jest: ^29.5.0 => 29.5.0
The text was updated successfully, but these errors were encountered: