Skip to content

Commit

Permalink
test: MultiGroup 테스트 코드 checked 속성 테스트 방법 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
ghdtjgus76 committed Jul 23, 2024
1 parent 9873cb3 commit 4fdad7f
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions packages/wow-ui/src/components/MultiGroup/MultiGroup.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ describe("multi group with checkbox", () => {
expect(checkboxes[1]).toHaveAttribute("aria-disabled", "true");
expect(checkboxes[2]).toHaveAttribute("aria-disabled", "false");

expect(checkboxes[0]).toHaveAttribute("aria-checked", "false");
expect(checkboxes[1]).toHaveAttribute("aria-checked", "false");
expect(checkboxes[2]).toHaveAttribute("aria-checked", "false");
expect(checkboxes[0]).not.toBeChecked();
expect(checkboxes[1]).not.toBeChecked();
expect(checkboxes[2]).not.toBeChecked();
});

it("should render checkbox components with external value provided", async () => {
Expand All @@ -53,9 +53,9 @@ describe("multi group with checkbox", () => {
);
const checkboxes = rendered.getAllByRole("checkbox");

expect(checkboxes[0]).toHaveAttribute("aria-checked", "false");
expect(checkboxes[1]).toHaveAttribute("aria-checked", "true");
expect(checkboxes[2]).toHaveAttribute("aria-checked", "true");
expect(checkboxes[0]).not.toBeChecked();
expect(checkboxes[1]).toBeChecked();
expect(checkboxes[2]).toBeChecked();
});

it("should render checkbox components with default value provided", () => {
Expand All @@ -68,9 +68,9 @@ describe("multi group with checkbox", () => {
);
const checkboxes = rendered.getAllByRole("checkbox");

expect(checkboxes[0]).toHaveAttribute("aria-checked", "true");
expect(checkboxes[1]).toHaveAttribute("aria-checked", "false");
expect(checkboxes[2]).toHaveAttribute("aria-checked", "true");
expect(checkboxes[0]).toBeChecked();
expect(checkboxes[1]).not.toBeChecked();
expect(checkboxes[2]).toBeChecked();
});

it("should toggle state when onChange event fired", async () => {
Expand Down Expand Up @@ -104,9 +104,9 @@ describe("multi group with checkbox", () => {
fireEvent.click(checkboxes[2]!);

await waitFor(() => {
expect(checkboxes[0]).toHaveAttribute("aria-checked", "true");
expect(checkboxes[1]).toHaveAttribute("aria-checked", "true");
expect(checkboxes[2]).toHaveAttribute("aria-checked", "false");
expect(checkboxes[0]).toBeChecked();
expect(checkboxes[1]).toBeChecked();
expect(checkboxes[2]).not.toBeChecked();
});
});

Expand Down Expand Up @@ -146,9 +146,9 @@ describe("multi group with checkbox", () => {
expect(checkboxes[1]).toHaveAttribute("aria-disabled", "true");
expect(checkboxes[2]).toHaveAttribute("aria-disabled", "true");

expect(checkboxes[0]).toHaveAttribute("aria-checked", "false");
expect(checkboxes[1]).toHaveAttribute("aria-checked", "false");
expect(checkboxes[2]).toHaveAttribute("aria-checked", "true");
expect(checkboxes[0]).not.toBeChecked();
expect(checkboxes[1]).not.toBeChecked();
expect(checkboxes[2]).toBeChecked();
});
});
});
Expand Down Expand Up @@ -185,9 +185,9 @@ describe("multi group with switch", () => {
expect(switches[1]).toHaveAttribute("aria-disabled", "true");
expect(switches[2]).toHaveAttribute("aria-disabled", "false");

expect(switches[0]).toHaveAttribute("aria-checked", "false");
expect(switches[1]).toHaveAttribute("aria-checked", "false");
expect(switches[2]).toHaveAttribute("aria-checked", "false");
expect(switches[0]).not.toBeChecked();
expect(switches[1]).not.toBeChecked();
expect(switches[2]).not.toBeChecked();
});

it("should render switch components with external value provided", async () => {
Expand All @@ -200,9 +200,9 @@ describe("multi group with switch", () => {
);
const switches = rendered.getAllByRole("checkbox");

expect(switches[0]).toHaveAttribute("aria-checked", "false");
expect(switches[1]).toHaveAttribute("aria-checked", "true");
expect(switches[2]).toHaveAttribute("aria-checked", "true");
expect(switches[0]).not.toBeChecked();
expect(switches[1]).toBeChecked();
expect(switches[2]).toBeChecked();
});

it("should render switch components with default value provided", () => {
Expand All @@ -215,9 +215,9 @@ describe("multi group with switch", () => {
);
const switches = rendered.getAllByRole("checkbox");

expect(switches[0]).toHaveAttribute("aria-checked", "true");
expect(switches[1]).toHaveAttribute("aria-checked", "false");
expect(switches[2]).toHaveAttribute("aria-checked", "true");
expect(switches[0]).toBeChecked();
expect(switches[1]).not.toBeChecked();
expect(switches[2]).toBeChecked();
});

it("should toggle state when onChange event fired", async () => {
Expand Down Expand Up @@ -247,9 +247,9 @@ describe("multi group with switch", () => {
fireEvent.click(switches[2]!);

await waitFor(() => {
expect(switches[0]).toHaveAttribute("aria-checked", "true");
expect(switches[1]).toHaveAttribute("aria-checked", "true");
expect(switches[2]).toHaveAttribute("aria-checked", "false");
expect(switches[0]).toBeChecked();
expect(switches[1]).toBeChecked();
expect(switches[2]).not.toBeChecked();
});
});

Expand Down Expand Up @@ -289,9 +289,9 @@ describe("multi group with switch", () => {
expect(switches[1]).toHaveAttribute("aria-disabled", "true");
expect(switches[2]).toHaveAttribute("aria-disabled", "true");

expect(switches[0]).toHaveAttribute("aria-checked", "false");
expect(switches[1]).toHaveAttribute("aria-checked", "false");
expect(switches[2]).toHaveAttribute("aria-checked", "true");
expect(switches[0]).not.toBeChecked();
expect(switches[1]).not.toBeChecked();
expect(switches[2]).toBeChecked();
});
});
});

0 comments on commit 4fdad7f

Please sign in to comment.