Skip to content

Commit 0df4ddd

Browse files
committed
Test edge case
1 parent c2e2a89 commit 0df4ddd

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/verification-input.test.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -331,41 +331,46 @@ describe("VerificationInput", () => {
331331
});
332332

333333
it("should apply class names", async () => {
334-
render(
335-
<VerificationInput value="22" autoFocus />
336-
);
334+
render(<VerificationInput value="22" autoFocus />);
337335

338336
expect(screen.getByTestId("character-0")).toHaveClass(
339337
"vi__character",
340338
"vi__character--filled"
341339
);
342-
343340
expect(screen.getByTestId("character-1")).toHaveClass(
344341
"vi__character",
345342
"vi__character--filled"
346343
);
347-
348344
expect(screen.getByTestId("character-2")).toHaveClass(
349345
"vi__character",
350346
"vi__character--selected"
351347
);
352-
353348
expect(screen.getByTestId("character-3")).toHaveClass(
354349
"vi__character",
355350
"vi__character--inactive"
356351
);
357-
358352
expect(screen.getByTestId("character-4")).toHaveClass(
359353
"vi__character",
360354
"vi__character--inactive"
361355
);
362-
363356
expect(screen.getByTestId("character-5")).toHaveClass(
364357
"vi__character",
365358
"vi__character--inactive"
366359
);
367360
});
368361

362+
it("should apply selected and filled to last character if value is complete", () => {
363+
render(<VerificationInput value="123456" autoFocus />);
364+
365+
expect(screen.getByTestId("character-4")).toHaveClass(
366+
"vi__character--filled"
367+
);
368+
expect(screen.getByTestId("character-5")).toHaveClass(
369+
"vi__character--filled",
370+
"vi__character--selected"
371+
);
372+
});
373+
369374
it("should apply custom class names", () => {
370375
render(
371376
<VerificationInput

0 commit comments

Comments
 (0)