components
components copied to clipboard
fix(material/snack-bar): Ensure snackbar enter/exit works with OnPush ancestor
By updating the "arbitrary-component" to OnPush
, the following test fails:
MatSnackBar should set the old snack bar animation state to complete and the new snack bar animation
.
The assertion that fails is the afterDismissed
spy, which never gets called. Adding markForCheck
in the exit
ensures the _animationState
is applied to the host and completes. If this is not done, the following listener never executes, including the _completeExist
: '(@state.done)': 'onAnimationEnd($event)'
.