Skip to content

Commit

Permalink
refactor(VSelect): menuListIndex -> listIndex naming for simplicity
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszgachowski committed Jul 15, 2019
1 parent 874f4d6 commit 28f4223
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/api-generator/src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ const VSelect = {
value: 'string'
},
{
name: 'update:menuListIndex',
name: 'update:listIndex',
value: 'number'
},
...inputEvents,
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/lang/en/components/Autocompletes.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"click:prepend": "Components.Inputs.events['click:prepend']",
"click:prepend-inner": "Components.TextFields.events['click:prepend-inner']",
"update:error": "Mixins.Validatable.events['update:error']",
"update:menuListIndex": "Emitted when menu item is selected using keyboard arrows",
"update:listIndex": "Emitted when menu item is selected using keyboard arrows",
"update:searchInput": "The `search-input.sync` event"
}
}
1 change: 1 addition & 0 deletions packages/docs/src/lang/en/components/Selects.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"click:prepend": "Components.Inputs.events['click:prepend']",
"click:prepend-inner": "Components.TextFields.events['click:prepend-inner']",
"update:error": "Mixins.Validatable.events['update:error']",
"update:listIndex": "Emitted when menu item is selected using keyboard arrows",
"update:searchInput": "The `search-input.sync` event"
}
}
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VSelect/VSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ export default VTextField.extend({

if (this.isMenuActive && this.$refs.menu) {
this.$refs.menu.changeListIndex(e)
this.$emit('update:menuListIndex', this.$refs.menu.listIndex)
this.$emit('update:listIndex', this.$refs.menu.listIndex)
}

// This should do something different
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -898,16 +898,16 @@ test('VAutocomplete.js', ({ mount, compileToFunctions }) => {
}
})

const menuIndexUpdate = jest.fn()
wrapper.vm.$on('update:menuListIndex', menuIndexUpdate)
const listIndexUpdate = jest.fn()
wrapper.vm.$on('update:listIndex', listIndexUpdate)

const input = wrapper.first('input')
const slot = wrapper.first('.v-input__slot')
slot.trigger('click')

input.trigger('keydown.down')
expect(menuIndexUpdate).toBeCalledWith(0)
expect(listIndexUpdate).toBeCalledWith(0)
input.trigger('keydown.down')
expect(menuIndexUpdate).toBeCalledWith(1)
expect(listIndexUpdate).toBeCalledWith(1)
})
})

0 comments on commit 28f4223

Please sign in to comment.