2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-04 06:32:23 +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
+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()
})