From 70f82bd21e19eb6a198a6333f4b4b91a447c1c49 Mon Sep 17 00:00:00 2001 From: bingmokaka <103943264+bingmokaka@users.noreply.github.com> Date: Sun, 28 Jun 2026 02:32:37 +0800 Subject: [PATCH] test(auth): cover password toggle reverting --- src/app/components/auth/__tests__/FormInput.test.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/components/auth/__tests__/FormInput.test.tsx b/src/app/components/auth/__tests__/FormInput.test.tsx index df97d530..b8fbfcd3 100644 --- a/src/app/components/auth/__tests__/FormInput.test.tsx +++ b/src/app/components/auth/__tests__/FormInput.test.tsx @@ -57,9 +57,15 @@ describe('Auth FormInput', () => { fireEvent.click(toggle); expect(input).toHaveAttribute('type', 'text'); - expect(screen.getByRole('button', { name: 'Hide Password' })).toHaveAttribute( + const hideToggle = screen.getByRole('button', { name: 'Hide Password' }); + expect(hideToggle).toHaveAttribute('aria-pressed', 'true'); + + fireEvent.click(hideToggle); + + expect(input).toHaveAttribute('type', 'password'); + expect(screen.getByRole('button', { name: 'Show Password' })).toHaveAttribute( 'aria-pressed', - 'true', + 'false', ); }); });