Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(VDatePicker): Add data-today attribute for identifying today's date #20968

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
})
})