Skip to content

Commit

Permalink
fix: edit review problem
Browse files Browse the repository at this point in the history
  • Loading branch information
linyonglu committed Feb 25, 2025
1 parent 8a177f9 commit 612b6f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-months-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@heroui/number-input": patch
---

- add missing logic to handle esc key to clear number-input value (#4850)
15 changes: 4 additions & 11 deletions packages/components/number-input/__tests__/number-input.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,10 @@ describe("NumberInput", () => {

it("should clear value when isClearable and pressing ESC key", async () => {
const onClear = jest.fn();
const defaultValue = 1234;
const defaultValue = 12;

const {container} = render(
<NumberInput
isClearable
defaultValue={defaultValue}
formatOptions={{useGrouping: false}}
onClear={onClear}
/>,
<NumberInput isClearable defaultValue={defaultValue} onClear={onClear} />,
);

const input = container.querySelector("input") as HTMLInputElement;
Expand All @@ -275,11 +270,9 @@ describe("NumberInput", () => {
});

it("should not clear value when pressing ESC key without isClearable", () => {
const defaultValue = 1234;
const defaultValue = 12;

const {container} = render(
<NumberInput defaultValue={defaultValue} formatOptions={{useGrouping: false}} />,
);
const {container} = render(<NumberInput defaultValue={defaultValue} />);

const input = container.querySelector("input") as HTMLInputElement;

Expand Down

0 comments on commit 612b6f8

Please sign in to comment.