2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-17 02:29:37 +03:00

use keydown for moving pointer, resolves #45

This commit is contained in:
Jeff Sagal
2016-05-31 18:35:01 -07:00
parent 2f9a1ff5b0
commit f8e549306a
3 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "vue-select",
"version": "1.1.1",
"version": "1.1.2",
"description": "A Vue.js project",
"author": "Jeff Sagal <sagalbot@gmail.com>",
"private": false,
+2 -2
View File
@@ -138,8 +138,8 @@
v-model="search"
@keydown.delete="maybeDeleteValue"
@keyup.esc="onEscape"
@keyup.up.prevent="typeAheadUp"
@keyup.down.prevent="typeAheadDown"
@keydown.up.prevent="typeAheadUp"
@keydown.down.prevent="typeAheadDown"
@keyup.enter.prevent="typeAheadSelect"
@blur="open = false"
@focus="open = true"
+8 -8
View File
@@ -327,7 +327,7 @@ describe('Select.vue', () => {
})
})
it('should move the pointer visually up the list on up arrow keyUp', () => {
it('should move the pointer visually up the list on up arrow keyDown', () => {
const vm = new Vue({
template: '<div><v-select :options="options"></v-select></div>',
components: {vSelect},
@@ -338,11 +338,11 @@ describe('Select.vue', () => {
vm.$children[0].typeAheadPointer = 1
trigger(vm.$children[0].$els.search, 'keyup', (e) => e.keyCode = 38)
trigger(vm.$children[0].$els.search, 'keydown', (e) => e.keyCode = 38)
expect(vm.$children[0].typeAheadPointer).toEqual(0)
})
it('should move the pointer visually down the list on down arrow keyUp', () => {
it('should move the pointer visually down the list on down arrow keyDown', () => {
const vm = new Vue({
template: '<div><v-select :options="options"></v-select></div>',
components: {vSelect},
@@ -352,7 +352,7 @@ describe('Select.vue', () => {
}).$mount()
vm.$children[0].typeAheadPointer = 1
trigger(vm.$children[0].$els.search, 'keyup', (e) => e.keyCode = 40)
trigger(vm.$children[0].$els.search, 'keydown', (e) => e.keyCode = 40)
expect(vm.$children[0].typeAheadPointer).toEqual(2)
})
@@ -371,7 +371,7 @@ describe('Select.vue', () => {
})
describe('Automatic Scrolling', () => {
it('should check if the scroll position needs to be adjusted on up arrow keyUp', () => {
it('should check if the scroll position needs to be adjusted on up arrow keyDown', () => {
const vm = new Vue({
template: '<div><v-select :options="options"></v-select></div>',
components: {vSelect},
@@ -382,11 +382,11 @@ describe('Select.vue', () => {
vm.$children[0].typeAheadPointer = 1
spyOn(vm.$children[0], 'maybeAdjustScroll')
trigger(vm.$children[0].$els.search, 'keyup', (e) => e.keyCode = 38)
trigger(vm.$children[0].$els.search, 'keydown', (e) => e.keyCode = 38)
expect(vm.$children[0].maybeAdjustScroll).toHaveBeenCalled()
})
it('should check if the scroll position needs to be adjusted on down arrow keyUp', () => {
it('should check if the scroll position needs to be adjusted on down arrow keyDown', () => {
const vm = new Vue({
template: '<div><v-select :options="options"></v-select></div>',
components: {vSelect},
@@ -396,7 +396,7 @@ describe('Select.vue', () => {
}).$mount()
spyOn(vm.$children[0], 'maybeAdjustScroll')
trigger(vm.$children[0].$els.search, 'keyup', (e) => e.keyCode = 40)
trigger(vm.$children[0].$els.search, 'keydown', (e) => e.keyCode = 40)
expect(vm.$children[0].maybeAdjustScroll).toHaveBeenCalled()
})