@seed-design/react-checkbox 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/index.ts +0 -1
- package/src/useCheckbox.test.tsx +4 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/react-checkbox",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/daangn/seed-design.git",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@radix-ui/react-compose-refs": "^1.1.2",
|
|
31
31
|
"@radix-ui/react-use-controllable-state": "1.2.2",
|
|
32
|
-
"@seed-design/dom-utils": "
|
|
33
|
-
"@seed-design/react-primitive": "
|
|
34
|
-
"@seed-design/react-supports": "0.0
|
|
32
|
+
"@seed-design/dom-utils": "^2.0.0",
|
|
33
|
+
"@seed-design/react-primitive": "^2.0.0",
|
|
34
|
+
"@seed-design/react-supports": "^1.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/react": "^19.1.6",
|
package/src/index.ts
CHANGED
package/src/useCheckbox.test.tsx
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import "@testing-library/
|
|
2
|
-
import { cleanup, render } from "@testing-library/react";
|
|
1
|
+
import { render } from "@testing-library/react";
|
|
3
2
|
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import {
|
|
3
|
+
import { describe, expect, it, mock } from "bun:test";
|
|
5
4
|
|
|
6
|
-
import type * as React from "react";
|
|
7
5
|
import type { ReactElement } from "react";
|
|
8
6
|
|
|
9
7
|
import {
|
|
@@ -13,8 +11,6 @@ import {
|
|
|
13
11
|
type CheckboxRootProps,
|
|
14
12
|
} from "./Checkbox";
|
|
15
13
|
|
|
16
|
-
afterEach(cleanup);
|
|
17
|
-
|
|
18
14
|
function setUp(jsx: ReactElement) {
|
|
19
15
|
return {
|
|
20
16
|
user: userEvent.setup(),
|
|
@@ -32,11 +28,6 @@ function Checkbox(props: CheckboxRootProps) {
|
|
|
32
28
|
}
|
|
33
29
|
|
|
34
30
|
describe("useCheckbox", () => {
|
|
35
|
-
global.CSS = {
|
|
36
|
-
// @ts-expect-error
|
|
37
|
-
supports: (_k, _v) => true,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
31
|
it("should render the checkbox correctly", () => {
|
|
41
32
|
const { getByRole } = setUp(<Checkbox />);
|
|
42
33
|
const checkbox = getByRole("checkbox");
|
|
@@ -67,7 +58,7 @@ describe("useCheckbox", () => {
|
|
|
67
58
|
});
|
|
68
59
|
|
|
69
60
|
it("should onCheckedChange is called when clicked", async () => {
|
|
70
|
-
const handleCheckedChange =
|
|
61
|
+
const handleCheckedChange = mock(() => {});
|
|
71
62
|
|
|
72
63
|
const { getByRole, user } = setUp(<Checkbox onCheckedChange={handleCheckedChange} />);
|
|
73
64
|
const checkbox = getByRole("checkbox");
|
|
@@ -115,7 +106,7 @@ describe("useCheckbox", () => {
|
|
|
115
106
|
});
|
|
116
107
|
|
|
117
108
|
it("should not onCheckedChange be called when clicked", async () => {
|
|
118
|
-
const handleCheckedChange =
|
|
109
|
+
const handleCheckedChange = mock(() => {});
|
|
119
110
|
|
|
120
111
|
const { getByRole, user } = setUp(
|
|
121
112
|
<Checkbox disabled={true} onCheckedChange={handleCheckedChange} />,
|