Skip to content

Commit

Permalink
feat(VDatePicker): Add data-today attribute for identifying today's date
Browse files Browse the repository at this point in the history
  • Loading branch information
maryamBaratii committed Feb 12, 2025
1 parent acff32f commit 71e8ea1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export const VDatePickerMonth = genericComponent<VDatePickerMonthSlots>()({
},
]}
data-v-date={ !item.isDisabled ? item.isoDate : undefined }
data-today={ item.isToday ? 'true' : undefined }
>

{ (props.showAdjacentMonths || !item.isAdjacent) && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,20 @@ describe.skip('VDatePicker.ts', () => {
expect(wrapper.findAll('.v-date-picker-table--month tbody button.v-date-picker--last-in-range')
.exists()).toBe(true)
})

it('adds data-today attribute to the correct date element', async () => {
const wrapper = mountFunction({
propsData: {
value: '2025-02',
type: 'month',
},
})

// Find the element that represents today's date
const todayElement = wrapper.find('[data-today="true"]')

// Assertions
expect(todayElement.exists()).toBe(true) // It should exist
expect(todayElement.attributes('data-today')).toBe('true') // Check attribute value
})
})

0 comments on commit 71e8ea1

Please sign in to comment.