-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(VDatePicker): recursive update when using hide-actions (#17914)
- Loading branch information
1 parent
bf76c7a
commit 6f30e56
Showing
4 changed files
with
102 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
packages/vuetify/src/labs/VDatePicker/__tests__/VDatePicker.spec.cy.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/// <reference types="../../../../types/cypress" /> | ||
|
||
import { ref } from 'vue' | ||
import { VDatePicker } from '../VDatePicker' | ||
import { Application } from '../../../../cypress/templates' | ||
|
||
describe('VDatePicker', () => { | ||
it('should update model directly when using hide-actions prop', () => { | ||
const model = ref(new Date(2023, 0, 1)) | ||
cy.mount(() => ( | ||
<Application> | ||
<VDatePicker v-model={model.value} hideActions /> | ||
</Application> | ||
)) | ||
.get('div[data-v-date="2023-1-2"]') | ||
.click() | ||
.vue() | ||
.then(wrapper => { | ||
const datePicker = wrapper.getComponent(VDatePicker) | ||
const emitted = datePicker.emitted('update:modelValue') | ||
expect(emitted).to.have.length(1) | ||
}) | ||
}) | ||
|
||
it('should not update model until clicking ok', () => { | ||
const model = ref(new Date(2023, 0, 1)) | ||
cy.mount(() => ( | ||
<Application> | ||
<VDatePicker v-model={model.value} /> | ||
</Application> | ||
)) | ||
.get('div[data-v-date="2023-1-2"]') | ||
.click() | ||
.vue() | ||
.then(wrapper => { | ||
const datePicker = wrapper.getComponent(VDatePicker) | ||
const emitted = datePicker.emitted('update:modelValue') | ||
expect(emitted).to.be.undefined | ||
}) | ||
.get('.v-picker__actions') | ||
.contains('OK') | ||
.click() | ||
.vue() | ||
.then(wrapper => { | ||
const datePicker = wrapper.getComponent(VDatePicker) | ||
const emitted = datePicker.emitted('update:modelValue') | ||
expect(emitted).to.have.length(1) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters