Angular · Middle · Question 69 of 75
How do you test an OnPush component after changing a signal input?
fixture.componentRef.setInput('user', mockUser);
fixture.detectChanges();- ✓Correct answer: Use
fixture.componentRef.setInput()and thendetectChanges() - 2Assign
component.user = mockUser - 3Signal inputs can't be set in tests
Explanation
Signal inputs are read-only from the class, and setInput goes through the same path as a parent binding, including OnPush marking.