Skip to content

Commit accacd9

Browse files
committed
remove test
1 parent a6e8083 commit accacd9

File tree

1 file changed

+1
-81
lines changed

1 file changed

+1
-81
lines changed
Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Copyright 2024 Marimo. All rights reserved. */
22

3-
import { act, fireEvent, render } from "@testing-library/react";
3+
import { act, render } from "@testing-library/react";
44
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
55
import type { IPluginProps } from "../../types";
66
import { NumberPlugin } from "../NumberPlugin";
@@ -61,84 +61,4 @@ describe("NumberPlugin", () => {
6161
rerender(plugin.render(resetProps));
6262
expect(input.value).toBe("0");
6363
});
64-
65-
it("handles both immediate prop changes and debounced user input", () => {
66-
const plugin = new NumberPlugin();
67-
const host = document.createElement("div");
68-
const setValue = vi.fn();
69-
70-
const props: IPluginProps<
71-
number | null,
72-
(typeof plugin)["validator"]["_type"]
73-
> = {
74-
host,
75-
value: 5,
76-
setValue,
77-
data: {
78-
start: 0,
79-
stop: 10,
80-
step: 1,
81-
label: null,
82-
debounce: true,
83-
fullWidth: false,
84-
},
85-
functions: {},
86-
};
87-
88-
// Initial render - setValue should be called immediately with initial value
89-
const { getByRole, rerender } = render(plugin.render(props));
90-
91-
// Wait for React-Aria NumberField to initialize
92-
act(() => {
93-
vi.advanceTimersByTime(0);
94-
});
95-
96-
expect(setValue).toHaveBeenCalledWith(5);
97-
98-
// Clear the mock to test debounced user input
99-
setValue.mockClear();
100-
101-
const input = getByRole("textbox", {
102-
name: "Number input",
103-
}) as HTMLInputElement;
104-
expect(input).toBeTruthy();
105-
106-
// Simulate user typing and committing the value
107-
act(() => {
108-
// Focus and type the value
109-
fireEvent.focus(input);
110-
// Simulate React-Aria NumberField value change
111-
fireEvent.change(input, { target: { value: "7" } });
112-
// Commit the value with Enter key
113-
fireEvent.keyDown(input, { key: "Enter" });
114-
});
115-
116-
// Let React process the input
117-
act(() => {
118-
vi.advanceTimersByTime(0);
119-
});
120-
121-
// Commit the value
122-
act(() => {
123-
fireEvent.blur(input);
124-
});
125-
126-
// Process debounced updates
127-
act(() => {
128-
vi.advanceTimersByTime(200);
129-
});
130-
131-
// Should call setValue after debounce for user input
132-
expect(setValue).toHaveBeenCalledWith(7);
133-
134-
// Clear the mock again to test immediate prop changes
135-
setValue.mockClear();
136-
137-
// Update props - should trigger immediate setValue
138-
const updatedProps = { ...props, value: 3 };
139-
rerender(plugin.render(updatedProps));
140-
expect(setValue).toHaveBeenCalledWith(3);
141-
142-
vi.useRealTimers();
143-
});
14464
});

0 commit comments

Comments
 (0)