Skip to content

Commit

Permalink
Merge pull request #2278 from quantified-uncertainty/user-event-fix
Browse files Browse the repository at this point in the history
@testing-library/user-event types are fixed, remove our workaround
  • Loading branch information
berekuk authored Sep 15, 2023
2 parents a6a68d2 + 5c1c7a0 commit 9cc2941
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@storybook/react-vite": "^7.2.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@testing-library/user-event": "^14.5.1",
"@types/jest": "^29.5.3",
"@types/lodash": "^4.14.196",
"@types/node": "^20.4.7",
Expand Down
11 changes: 5 additions & 6 deletions packages/components/test/autorun.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "@testing-library/jest-dom";
import { act, render, screen, waitFor } from "@testing-library/react";
import { userEvent } from "./user-event.js";
import { userEvent } from "@testing-library/user-event";

import { SquigglePlayground } from "../src/index.js";

Expand All @@ -14,7 +14,7 @@ test("Autorun is default", async () => {
});

test("Autorun can be switched off", async () => {
const user = userEvent.setup(); // typescript issue is due to ESM mess
const user = userEvent.setup();
act(() => render(<SquigglePlayground defaultCode="70*30" />));

expect(screen.getByTestId("autorun-controls")).toHaveAttribute(
Expand All @@ -28,10 +28,9 @@ test("Autorun can be switched off", async () => {
)
);

await act(
async () =>
await user.click(screen.getByTestId("autorun-controls").firstChild) // disable
);
await act(async () => {
await user.click(screen.getByTestId("autorun-controls").firstElementChild!); // disable
});

expect(screen.getByTestId("autorun-controls")).toHaveAttribute(
"aria-checked",
Expand Down
7 changes: 0 additions & 7 deletions packages/components/test/user-event.ts

This file was deleted.

14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 comments on commit 9cc2941

@vercel
Copy link

@vercel vercel bot commented on 9cc2941 Sep 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 9cc2941 Sep 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 9cc2941 Sep 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 9cc2941 Sep 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

quri-ui – ./packages/ui

quri-ui-git-main-quantified-uncertainty.vercel.app
quri-ui-quantified-uncertainty.vercel.app
quri-ui.vercel.app

Please sign in to comment.