File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 874
874
*/
875
875
toggleDropdown (e ) {
876
876
if (e .target === this .$refs .openIndicator || e .target === this .$refs .search || e .target === this .$refs .toggle ||
877
- e .target === this . $refs . selectedOptions || e .target === this .$el ) {
877
+ e .target . classList . contains ( ' selected-tag ' ) || e .target === this .$el ) {
878
878
if (this .open ) {
879
879
this .$refs .search .blur () // dropdown will close on blur
880
880
} else {
Original file line number Diff line number Diff line change @@ -403,6 +403,26 @@ describe('Select.vue', () => {
403
403
} )
404
404
} )
405
405
406
+ it ( 'should open the dropdown when the selected tag is clicked' , ( done ) => {
407
+ const vm = new Vue ( {
408
+ template : '<div><v-select :options="options" :value="value"></v-select></div>' ,
409
+ components : { vSelect} ,
410
+ data : {
411
+ value : [ { label : 'one' } ] ,
412
+ options : [ { label : 'one' } ]
413
+ }
414
+ } ) . $mount ( )
415
+
416
+ const selectedTag = vm . $children [ 0 ] . $el . getElementsByClassName ( 'selected-tag' ) [ 0 ]
417
+ vm . $children [ 0 ] . toggleDropdown ( { target : selectedTag } )
418
+ Vue . nextTick ( ( ) => {
419
+ Vue . nextTick ( ( ) => {
420
+ expect ( vm . $children [ 0 ] . open ) . toEqual ( true )
421
+ done ( )
422
+ } )
423
+ } )
424
+ } )
425
+
406
426
it ( 'can close the dropdown when the el is clicked' , ( done ) => {
407
427
const vm = new Vue ( {
408
428
template : '<div><v-select></v-select></div>' ,
You can’t perform that action at this time.
0 commit comments