Skip to content

Commit

Permalink
test: Switch 테스트 코드 checked 속성 테스트 방법 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
ghdtjgus76 committed Jul 23, 2024
1 parent 4fdad7f commit 2495dfc
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/wow-ui/src/components/Switch/Switch.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ describe("toggle", () => {
rendered = render(<Switch label="Label" value="switch" />);
});

it("should render with attributes aria-checked to be false, aria-disabled to be false by default", () => {
it("should render with attributes checked to be false, aria-disabled to be false by default", () => {
const switchComponent = rendered.getByRole("checkbox");

expect(switchComponent).toHaveAttribute("aria-checked", "false");
expect(switchComponent).not.toBeChecked();
expect(switchComponent).toHaveAttribute("aria-disabled", "false");
});

Expand All @@ -29,7 +29,7 @@ describe("toggle", () => {
fireEvent.click(switchComponent);

await waitFor(() => {
expect(switchComponent).toHaveAttribute("aria-checked", "true");
expect(switchComponent).toBeChecked();
expect(switchComponent).toHaveAttribute("aria-disabled", "false");
});
});
Expand All @@ -40,7 +40,7 @@ describe("toggle", () => {
fireEvent.type(switchComponent, "{enter}");

await waitFor(() => {
expect(switchComponent).toHaveAttribute("aria-checked", "true");
expect(switchComponent).toBeChecked();
expect(switchComponent).toHaveAttribute("aria-disabled", "false");
});
});
Expand All @@ -51,7 +51,7 @@ describe("toggle", () => {
fireEvent.type(switchComponent, "{space}");

await waitFor(() => {
expect(switchComponent).toHaveAttribute("aria-checked", "true");
expect(switchComponent).toBeChecked();
expect(switchComponent).toHaveAttribute("aria-disabled", "false");
});
});
Expand All @@ -64,10 +64,10 @@ describe("when defaultChecked is true", () => {
rendered = render(<Switch defaultChecked value="switch" />);
});

it("should render with attributes aria-checked to be true, aria-disabled to be false", () => {
it("should render with attributes checked to be true, aria-disabled to be false", () => {
const switchComponent = rendered.getByRole("checkbox");

expect(switchComponent).toHaveAttribute("aria-checked", "true");
expect(switchComponent).toBeChecked();
expect(switchComponent).toHaveAttribute("aria-disabled", "false");
});
});
Expand Down Expand Up @@ -108,7 +108,7 @@ describe("disabled", () => {
fireEvent.type(switchComponent, "{enter}");

await waitFor(() => {
expect(switchComponent).toHaveAttribute("aria-checked", "false");
expect(switchComponent).not.toBeChecked();
expect(switchComponent).toHaveAttribute("aria-disabled", "true");
});
});
Expand All @@ -119,7 +119,7 @@ describe("disabled", () => {
fireEvent.type(switchComponent, "{space}");

await waitFor(() => {
expect(switchComponent).toHaveAttribute("aria-checked", "false");
expect(switchComponent).not.toBeChecked();
expect(switchComponent).toHaveAttribute("aria-disabled", "true");
});
});
Expand Down Expand Up @@ -166,7 +166,7 @@ describe("external control and events", () => {
fireEvent.click(switchComponent);

await waitFor(() => {
expect(switchComponent).toHaveAttribute("aria-checked", "true");
expect(switchComponent).toBeChecked();
expect(switchComponent).toHaveAttribute("aria-disabled", "false");
});
});
Expand Down

0 comments on commit 2495dfc

Please sign in to comment.