Skip to content

Commit

Permalink
Migrate Enzyme Test to @testing-library/react in exclude_times_test.js
Browse files Browse the repository at this point in the history
This commit updates the test case in exclude_times_test.js from using Enzyme to using @testing-library/react as requested by @martijnrusschen on [the issue #4317](#4317 (comment))
  • Loading branch information
Balaji Sridharan committed Oct 14, 2023
1 parent 79590b7 commit 5b82a96
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions test/exclude_times_test.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from "react";
import { mount } from "enzyme";
import { render } from "@testing-library/react";
import { setTime, newDate } from "../src/date_utils";
import DatePicker from "../src/index.jsx";

describe("DatePicker", () => {
it("should disable times specified in excludeTimes props", () => {
var now = newDate();
var datePicker = mount(
const now = newDate();

const { container: datePicker } = render(
<DatePicker
open
showTimeSelect
Expand All @@ -18,8 +19,10 @@ describe("DatePicker", () => {
]}
/>,
);
expect(
datePicker.find(".react-datepicker__time-list-item--disabled"),
).toHaveLength(4);

const disabledTimeItems = datePicker.querySelectorAll(
".react-datepicker__time-list-item--disabled",
);
expect(disabledTimeItems.length).toBe(4);
});
});

0 comments on commit 5b82a96

Please sign in to comment.