diff --git a/src/fields/date-field/dateField.stories.tsx b/src/fields/date-field/dateField.stories.tsx
index 2e6a1f1..44f1577 100644
--- a/src/fields/date-field/dateField.stories.tsx
+++ b/src/fields/date-field/dateField.stories.tsx
@@ -39,7 +39,7 @@ export const InitializedInput = formStory({
),
},
diff --git a/src/hooks/use-date-field-props/useDateFieldProps.test.tsx b/src/hooks/use-date-field-props/useDateFieldProps.test.tsx
index 82046fd..37f5a5b 100644
--- a/src/hooks/use-date-field-props/useDateFieldProps.test.tsx
+++ b/src/hooks/use-date-field-props/useDateFieldProps.test.tsx
@@ -7,6 +7,17 @@ import { dateField } from "../../fields/date-field";
import { getDateString } from "../../fields/date-field/DateInput.mock";
describe("useDateFieldProps", () => {
+ it("initializes the field via options", () => {
+ const field = dateField();
+ const initialValue = new Date("2024/03/31");
+
+ const { result: props } = renderHook(() =>
+ useDateFieldProps(field, { initialValue }),
+ );
+
+ expect(props.current.value).toBe(initialValue);
+ });
+
it("reads empty value as undefined", async () => {
const field = dateField({ value: new Date() });
const { result } = renderHook(() => useDateFieldProps(field));
diff --git a/src/hooks/use-number-field-props/useNumberFieldProps.test.tsx b/src/hooks/use-number-field-props/useNumberFieldProps.test.tsx
index 6d882c0..96751fe 100644
--- a/src/hooks/use-number-field-props/useNumberFieldProps.test.tsx
+++ b/src/hooks/use-number-field-props/useNumberFieldProps.test.tsx
@@ -10,11 +10,11 @@ describe("useNumberFieldProps()", () => {
it("initializes the field via options", async () => {
const field = numberField();
- const props = renderHook(() =>
+ const { result: props } = renderHook(() =>
useNumberFieldProps(field, { initialValue: 42 }),
);
- expect(props.result.current.value).toBe(42);
+ expect(props.current.value).toBe(42);
});
it("reads empty input value as undefined with props.value as empty string", async () => {
diff --git a/src/hooks/use-text-field-props/useTextFieldProps.test.ts b/src/hooks/use-text-field-props/useTextFieldProps.test.ts
deleted file mode 100644
index 7980a41..0000000
--- a/src/hooks/use-text-field-props/useTextFieldProps.test.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { renderHook } from "@testing-library/react";
-import { describe, expect, it } from "vitest";
-
-import { useTextFieldProps } from "./useTextFieldProps";
-import { textField } from "../../fields";
-
-describe("useTextFieldProps()", () => {
- it("initializes the field via options", async () => {
- const field = textField();
-
- const props = renderHook(() =>
- useTextFieldProps(field, { initialValue: "hello" }),
- );
-
- expect(props.result.current.value).toBe("hello");
- });
-});
diff --git a/src/hooks/use-text-field-props/useTextFieldProps.test.tsx b/src/hooks/use-text-field-props/useTextFieldProps.test.tsx
new file mode 100644
index 0000000..353bab4
--- /dev/null
+++ b/src/hooks/use-text-field-props/useTextFieldProps.test.tsx
@@ -0,0 +1,29 @@
+import { act, render, renderHook, screen } from "@testing-library/react";
+import { userEvent } from "@testing-library/user-event";
+import { describe, expect, it } from "vitest";
+
+import { useTextFieldProps } from "./useTextFieldProps";
+import { textField } from "../../fields";
+
+describe("useTextFieldProps()", () => {
+ it("initializes the field via options", async () => {
+ const field = textField();
+
+ const { result: props } = renderHook(() =>
+ useTextFieldProps(field, { initialValue: "hello" }),
+ );
+
+ expect(props.current.value).toBe("hello");
+ });
+
+ it("reads value as string", async () => {
+ const field = textField();
+
+ const { result: props } = renderHook(() => useTextFieldProps(field));
+ render();
+
+ await act(() => userEvent.type(screen.getByRole("textbox"), "x"));
+
+ expect(props.current.value).toBe("x");
+ });
+});