From f700fc8b872382643a5329834feece850ec1ea9f Mon Sep 17 00:00:00 2001 From: waterplea Date: Mon, 25 Mar 2024 14:08:30 +0700 Subject: [PATCH] chore: fix unit --- .../test/input-card-grouped.component.spec.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/addon-commerce/components/input-card-grouped/test/input-card-grouped.component.spec.ts b/projects/addon-commerce/components/input-card-grouped/test/input-card-grouped.component.spec.ts index e9f492186118..de2d77503e2d 100644 --- a/projects/addon-commerce/components/input-card-grouped/test/input-card-grouped.component.spec.ts +++ b/projects/addon-commerce/components/input-card-grouped/test/input-card-grouped.component.spec.ts @@ -23,6 +23,7 @@ import { import {TuiSvgModule} from '@taiga-ui/core'; import {TuiNativeInputPO} from '@taiga-ui/testing'; import type {Mock} from 'jest-mock'; +import {firstValueFrom, timer} from 'rxjs'; describe('InputCardGrouped', () => { @Component({ @@ -175,10 +176,12 @@ describe('InputCardGrouped', () => { expect(inputCardPO.focused).toBe(true); }); - it('focuses expire input when valid card is entered', () => { + it('focuses expire input when valid card is entered', async () => { inputCardPO.focus(); inputCardPO.sendText('563693784073'); + await firstValueFrom(timer(100)); + expect(inputExpirePO.focused).toBe(true); }); @@ -190,11 +193,13 @@ describe('InputCardGrouped', () => { expect(inputExpirePO.focused).toBe(true); }); - it('focuses cvc input when expiration date is fully entered', () => { + it('focuses cvc input when expiration date is fully entered', async () => { inputCardPO.focus(); inputCardPO.sendText('563693784073'); inputExpirePO.sendText('12/21'); + await firstValueFrom(timer(100)); + expect(inputCVCPO.focused).toBe(true); }); });