Skip to content

Commit

Permalink
fix(VSelect): disable arrows on readonly select (#11223)
Browse files Browse the repository at this point in the history
fixes #11164

* fix(VSelect): disable arrows on readonly select

* test(VSelect): add coverage for fix

Co-authored-by: John Leider <john.j.leider@gmail.com>
  • Loading branch information
fpdrozd and johnleider committed Apr 24, 2020
1 parent c9cc289 commit fd7a8b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/vuetify/src/components/VSelect/VSelect.ts
Expand Up @@ -644,6 +644,8 @@ export default baseMixins.extend<options>().extend({
}
},
onKeyDown (e: KeyboardEvent) {
if (this.readonly) return

const keyCode = e.keyCode
const menu = this.$refs.menu

Expand Down
11 changes: 11 additions & 0 deletions packages/vuetify/src/components/VSelect/__tests__/VSelect4.spec.ts
Expand Up @@ -2,6 +2,7 @@
import VSelect from '../VSelect'

// Utilities
import { waitAnimationFrame } from '../../../../test'
import {
mount,
Wrapper,
Expand Down Expand Up @@ -304,6 +305,16 @@ describe('VSelect.ts', () => {
await wrapper.vm.$nextTick()

expect(wrapper.vm.internalValue).toBe('Foo')

input.trigger('keydown.up')

// Wait for keydown event to propagate
await wrapper.vm.$nextTick()

// Waiting for items to be rendered
await waitAnimationFrame()

expect(wrapper.vm.internalValue).toBe('Foo')
})

it('should emit listIndex event when navigated by keyboard', async () => {
Expand Down

0 comments on commit fd7a8b3

Please sign in to comment.