test(account): 修复通知动画测试的类型感知 lint

This commit is contained in:
lsdsjy committed 2026-10-16 18:26:26 +08:00
1 parent da6c16747e
commit 00a1155f5a
1 file changed
+8 -6
@@ -13,7 +13,7 @@ it.each(['unavailable', 'reduced motion'])('closes without animation when animat
card.animate = animate
card.style.transitionDuration = '0s'
}
const dismiss = vi.fn(() => card.remove())
const dismiss = vi.fn(() => { card.remove() })
dismissNotice(card, dismiss)
expect(dismiss).toHaveBeenCalledOnce()
expect(animate).not.toHaveBeenCalled()
@@ -26,8 +26,10 @@ it('animates a surviving card from its old position and height and cancels an in
stack.append(first, next)
document.body.append(stack)
first.style.transitionDuration = '0.25s'
first.animate = vi.fn<HTMLElement['animate']>()
next.animate = vi.fn<HTMLElement['animate']>()
const animateFirst = vi.fn<HTMLElement['animate']>()
const animateNext = vi.fn<HTMLElement['animate']>()
first.animate = animateFirst
next.animate = animateNext
first.getAnimations = () => []
const cancel = vi.fn()
const interrupted: Pick<Animation, 'cancel'> = { cancel }
@@ -36,10 +38,10 @@ it('animates a surviving card from its old position and height and cancels an in
.mockReturnValueOnce(new DOMRect(14, 196, 272, 100))
.mockReturnValueOnce(new DOMRect(10, 100, 280, 200))
next.style.transform = 'translateY(0px) scaleX(1)'
dismissNotice(first, () => first.remove())
dismissNotice(first, () => { first.remove() })
expect(cancel).toHaveBeenCalledOnce()
expect(first.animate).not.toHaveBeenCalled()
expect(next.animate).toHaveBeenCalledWith([
expect(animateFirst).not.toHaveBeenCalled()
expect(animateNext).toHaveBeenCalledWith([
{ transform: 'translate(0px, 96px) scale(0.9714285714285714, 0.5)' },
{ transform: 'translateY(0px) scaleX(1)' },
], { duration: 250, easing: 'ease-out' })