Skip to content

Commit a19aa97

Browse files
committed
fix: incorrect isDirty check and unit test
1 parent 38cae09 commit a19aa97

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

packages/vuetify/src/components/VCombobox/VCombobox.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,7 @@ export const VCombobox = genericComponent<new <
478478
slots['append-item'] ||
479479
slots['no-data']
480480
)
481-
const isEmptyString = model.value.length === 1 && model.value[0].value === ''
482-
const isDirty = model.value.length > 0 && !isEmptyString
481+
const isDirty = model.value.length > 0
483482
const textFieldProps = VTextField.filterProps(props)
484483

485484
return (

packages/vuetify/src/components/VCombobox/__tests__/VCombobox.spec.browser.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,19 +382,22 @@ describe('VCombobox', () => {
382382
})
383383

384384
it('should show placeholder if initial value is empty string', async () => {
385-
render(() => (
385+
const emptyString = ref('')
386+
387+
const { getByPlaceholderText } = render(() => (
386388
<VCombobox
387-
v-model={''}
389+
v-model={ emptyString.value }
388390
items={['a', 'b', 'c']}
389391
multiple
390392
itemTitle="text"
391393
itemValue="value"
394+
placeholder="placeholder"
392395
returnObject
393396
/>
394397
))
395398

396-
const inputField = screen.getByCSS('.v-field')
397-
expect(inputField).toBeUndefined()
399+
const inputField = getByPlaceholderText("placeholder")
400+
expect(inputField).toBeDisplayed()
398401
})
399402
})
400403

0 commit comments

Comments
 (0)