Skip to content

Commit

Permalink
Migrate Slider to RTL. (#845)
Browse files Browse the repository at this point in the history
* Migrate Slider to RTL.
  • Loading branch information
huwshimi authored Nov 3, 2022
1 parent 5575546 commit 03b1046
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/components/Slider/Slider.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { render, screen } from "@testing-library/react";
import { shallow } from "enzyme";
import React from "react";

import Slider from "./Slider";

describe("Slider", () => {
it("can render without an additional number input", () => {
const wrapper = shallow(
render(
<Slider
max={10}
min={0}
Expand All @@ -15,18 +14,16 @@ describe("Slider", () => {
value={5}
/>
);
expect(wrapper.find("input[type='number']").exists()).toBe(false);
expect(screen.queryByRole("spinbutton")).not.toBeInTheDocument();
});

it("can render with an additional number input", () => {
const wrapper = shallow(
render(
<Slider max={10} min={0} onChange={jest.fn()} showInput value={5} />
);
expect(wrapper.find("input[type='number']").exists()).toBe(true);
expect(screen.getByRole("spinbutton")).toBeInTheDocument();
});
});

describe("Slider RTL", () => {
it("can display an error", async () => {
render(
<Slider
Expand Down

0 comments on commit 03b1046

Please sign in to comment.