test(parental-lock): stub getAnimations without a conflicting type

The shake replay spec typed the form field as
`HTMLElement & { getAnimations?: … }`, which clashes with the DOM's own
`getAnimations` signature (TS2322 in the spec typecheck). Jest does not
type-check, so only CI caught it. The stub is now installed with
Object.defineProperty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5.5 committed 2026-10-01 09:05:10 +02:00
1 parent 2e49c6feaf
commit bdb731c0d9
1 file changed
+4 -4
@@ -247,15 +247,15 @@ describe('ParentalLockPinDialogComponent', () => {
const dialog = await openDialog({ mode: 'set' });
const field = dialog
.query('parental-lock-pin')
?.closest('mat-form-field') as HTMLElement & {
getAnimations?: () => Partial<CSSAnimation>[];
};
?.closest('mat-form-field');
// jsdom has no Web Animations: stand in for the running shake.
const shake: Partial<CSSAnimation> = {
animationName: '_ngcontent-x_pin-dialog-shake',
currentTime: 250,
};
field.getAnimations = () => [shake];
Object.defineProperty(field, 'getAnimations', {
value: () => [shake],
});
await dialog.type('parental-lock-pin', '24');
await dialog.pressEnter();