Skip to content

Commit

Permalink
test(DateSelect): improved tests DEV-53
Browse files Browse the repository at this point in the history
  • Loading branch information
giubatt committed May 19, 2021
1 parent a10204b commit 7ff7d25
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/components/DateSelect/DateSelect.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ describe("DateSelect", () => {
test("onChange is called when an option is selected", async () => {
const onChange = jest.fn()
render(
<DateSelect onChange={onChange}>
<DateSelect
onChange={onChange}
value={{
from: "",
to: "",
}}
>
<DateSelect.Option value={{ from: "12/05/2021", to: "12/05/2021" }}>
Today
</DateSelect.Option>
Expand All @@ -43,6 +49,18 @@ describe("DateSelect", () => {
})
})

test("select button shows current selected item text", async () => {
const value = { from: "12/05/2021", to: "12/05/2021" }

render(
<DateSelect value={value}>
<DateSelect.Option value={value}>Today</DateSelect.Option>
</DateSelect>
)

expect(screen.getByText(/today/i)).toBeInTheDocument()
})

test("custom date range popover appears when custom option is clicked", async () => {
render(
<DateSelect>
Expand Down

0 comments on commit 7ff7d25

Please sign in to comment.