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();

Explanation

Signal inputs are read-only from the class, and setInput goes through the same path as a parent binding, including OnPush marking.

Further reading

Problem with a question

Angular · Middle · question 69

Test yourself

Take the Angular · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz