Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
zernonia committed Feb 18, 2025
2 parents 3e7fee0 + 03826eb commit 9d9582b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/DateField/DateFieldRoot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ watch(locale, (value) => {
})
watch(modelValue, (_modelValue) => {
if (!isNullish(_modelValue) || placeholder.value.compare(_modelValue) !== 0) {
if (!isNullish(_modelValue) && placeholder.value.compare(_modelValue) !== 0) {
placeholder.value = _modelValue.copy()
}
})
Expand Down
13 changes: 13 additions & 0 deletions packages/core/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-radix-vue-calendar-cell-trigger]:not([data-outside-view])')!

await user.click(targetCell)
expect(calendar.querySelector('[data-selected]')).toBeInTheDocument()
await user.click(targetCell)
expect(calendar.querySelector('[data-selected]')).not.toBeInTheDocument()
})
})
3 changes: 2 additions & 1 deletion packages/core/src/Presence/usePresence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ export function usePresence(
// We avoid doing so during cleanup as the node may change but still exist.
dispatch('ANIMATION_END')

ownerWindow?.clearTimeout(timeoutId)
if (timeoutId !== undefined)
ownerWindow?.clearTimeout(timeoutId)
oldNode?.removeEventListener('animationstart', handleAnimationStart)
oldNode?.removeEventListener('animationcancel', handleAnimationEnd)
oldNode?.removeEventListener('animationend', handleAnimationEnd)
Expand Down

0 comments on commit 9d9582b

Please sign in to comment.