mirror of
https://github.com/mgeeky/decode-spam-headers.git
synced 2026-02-22 13:33:30 +01:00
MAESTRO: Make decode-all toggle stateful
This commit is contained in:
@@ -110,6 +110,27 @@ describe("AnalysisControls", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("updates toggles without a controlled config", async () => {
|
||||
setupFetchMock(sampleTests);
|
||||
const handleChange = vi.fn();
|
||||
|
||||
const { container } = render(<AnalysisControls onChange={handleChange} />);
|
||||
|
||||
await act(async () => {
|
||||
await flushPromises();
|
||||
});
|
||||
|
||||
const decodeToggle = getToggle(container, "toggle-decode-all");
|
||||
act(() => {
|
||||
decodeToggle.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
||||
});
|
||||
|
||||
expect(decodeToggle.getAttribute("aria-checked")).toBe("true");
|
||||
expect(handleChange).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({ decodeAll: true }),
|
||||
);
|
||||
});
|
||||
|
||||
it("updates toggles on click and keyboard", async () => {
|
||||
setupFetchMock(sampleTests);
|
||||
const handleChange = vi.fn();
|
||||
|
||||
Reference in New Issue
Block a user