Skip to content

Commit

Permalink
test: include test for select and deselect date
Browse files Browse the repository at this point in the history
  • Loading branch information
zernonia committed Feb 14, 2025
1 parent 5342965 commit b0f0b3d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/radix-vue/src/DatePicker/DatePicker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,17 @@ describe('datePicker', async () => {
expect(month).not.toHaveAttribute('tabindex')
expect(year).not.toHaveAttribute('tabindex')
})

it('should select and deselect a date', async () => {
const { user, trigger, getByTestId } = setup()

await user.click(trigger)
const calendar = getByTestId('calendar')
const targetCell = calendar.querySelector('div[data-reka-calendar-cell-trigger]:not([data-outside-view])')!

await user.click(targetCell)
expect(calendar.querySelector('[data-selected]')).toBeInTheDocument()

Check failure on line 248 in packages/radix-vue/src/DatePicker/DatePicker.test.ts

View workflow job for this annotation

GitHub Actions / test

src/DatePicker/DatePicker.test.ts > datePicker > should select and deselect a date

Error: expect(received).toBeInTheDocument() received value must be an HTMLElement or an SVGElement. ❯ src/DatePicker/DatePicker.test.ts:248:55
await user.click(targetCell)
expect(calendar.querySelector('[data-selected]')).not.toBeInTheDocument()
})
})

0 comments on commit b0f0b3d

Please sign in to comment.