File tree Expand file tree Collapse file tree 2 files changed +30
-12
lines changed Expand file tree Collapse file tree 2 files changed +30
-12
lines changed Original file line number Diff line number Diff line change 549
549
}
550
550
},
551
551
552
+ /**
553
+ * Select the current value if selectOnTab is enabled
554
+ */
555
+ onTab: {
556
+ type: Function ,
557
+ default : function () {
558
+ if (this .selectOnTab ) {
559
+ this .typeAheadSelect ();
560
+ }
561
+ },
562
+ },
563
+
552
564
/**
553
565
* Enable/disable creating options from searchInput.
554
566
* @type {Boolean}
927
939
}
928
940
},
929
941
930
- /**
931
- * Select the current value if selectOnTab is enabled
932
- * @return {void}
933
- */
934
- onTab () {
935
- if (this .selectOnTab ) {
936
- this .typeAheadSelect ();
937
- }
938
- },
939
-
940
942
/**
941
943
* Determine if an option exists
942
944
* within this.mutableOptions array.
Original file line number Diff line number Diff line change @@ -109,6 +109,22 @@ describe('Select.vue', () => {
109
109
expect ( vm . $children [ 0 ] . mutableValue ) . toEqual ( vm . value )
110
110
} )
111
111
112
+ it ( 'can select an option on tab' , ( done ) => {
113
+ const vm = new Vue ( {
114
+ template : `<div><v-select :options="['one','two']" select-on-tab></v-select></div>` ,
115
+ components : { vSelect} ,
116
+ } ) . $mount ( )
117
+
118
+ vm . $children [ 0 ] . typeAheadPointer = 0
119
+
120
+ trigger ( vm . $children [ 0 ] . $refs . search , 'keydown' , ( e ) => e . keyCode = 9 )
121
+
122
+ Vue . nextTick ( ( ) => {
123
+ expect ( vm . $children [ 0 ] . mutableValue ) . toEqual ( 'one' ) ;
124
+ done ( ) ;
125
+ } )
126
+ } )
127
+
112
128
it ( 'can deselect a pre-selected object' , ( ) => {
113
129
const vm = new Vue ( {
114
130
template : '<div><v-select :options="options" :value="value" :multiple="true"></v-select></div>' ,
@@ -1377,7 +1393,7 @@ describe('Select.vue', () => {
1377
1393
value : 'foo'
1378
1394
}
1379
1395
} ) . $mount ( )
1380
-
1396
+
1381
1397
expect ( vm . mutableValue ) . toEqual ( 'foo' )
1382
1398
vm . $el . querySelector ( 'button.clear' ) . click ( )
1383
1399
expect ( vm . mutableValue ) . toEqual ( null )
@@ -1396,6 +1412,6 @@ describe('Select.vue', () => {
1396
1412
const buttonEl = vm . $el . querySelector ( 'button.clear' )
1397
1413
expect ( buttonEl . disabled ) . toEqual ( true ) ;
1398
1414
} )
1399
-
1415
+
1400
1416
} ) ;
1401
1417
} )
You can’t perform that action at this time.
0 commit comments