Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function renderBlock(adapter: AccountPhoneNumbersAdapter, props: Partial<P
}

const rowFor = (display: string) => screen.getByText(display).closest('li') as HTMLElement;
const codeBox = (index: number) => screen.getByLabelText(`Digit ${index} of 6`);
const codeField = () => screen.getByLabelText('Verification code');

describe('AccountPhoneNumbers', () => {
it('lists numbers with their status on one line', async () => {
Expand Down Expand Up @@ -79,13 +79,13 @@ describe('AccountPhoneNumbers', () => {
expect(adapter.sendCode).toHaveBeenCalledWith({ id: 'new-0', number: '+12025550143' });
expect(await screen.findByText('Enter the 6-digit code sent to +1 202 555 0143.')).toBeInTheDocument();

await user.click(codeBox(1));
await user.click(codeField());
await user.paste('000000');
await user.click(screen.getByRole('button', { name: 'Verify' }));
expect(await screen.findByRole('alert')).toHaveTextContent('That code didn’t work.');
expect(codeBox(1)).toHaveAttribute('aria-invalid', 'true');
expect(codeField()).toHaveAttribute('aria-invalid', 'true');

await user.click(codeBox(1));
await user.click(codeField());
await user.paste('123456');
await user.click(screen.getByRole('button', { name: 'Verify' }));
await waitFor(() => expect(within(rowFor('+1 202 555 0143')).getByText('Verified')).toBeInTheDocument());
Expand Down
8 changes: 6 additions & 2 deletions packages/ui/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -2632,13 +2632,17 @@
"name": "input-otp",
"type": "registry:ui",
"title": "Input OTP",
"description": "A one-time-code input with one box per digit that handles typing, Backspace, arrows, paste, and OS autofill as one value.",
"description": "A one-time-code input that draws one slot per digit over a single field, so typing, selection, paste, and OS autofill behave like text, with a gliding focus ring and digit motion.",
"categories": [
"input"
],
"docs": "Import: `import { InputOtp } from '@/components/ui/input-otp'`",
"dependencies": [
"motion"
],
"registryDependencies": [
"cn"
"cn",
"fluid-highlight"
],
"files": [
{
Expand Down
Loading
Loading