File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 847
847
* @return {void}
848
848
*/
849
849
toggleDropdown (e ) {
850
- if (e .target === this .$refs .openIndicator || e .target === this .$refs .search || e .target === this .$refs .toggle || e .target === this .$el ) {
850
+ if (e .target === this .$refs .openIndicator || e .target === this .$refs .search || e .target === this .$refs .toggle ||
851
+ e .target .classList .contains (' selected-tag' ) || e .target === this .$el ) {
851
852
if (this .open ) {
852
853
this .$refs .search .blur () // dropdown will close on blur
853
854
} else {
Original file line number Diff line number Diff line change @@ -433,6 +433,26 @@ describe('Select.vue', () => {
433
433
} )
434
434
} )
435
435
436
+ it ( 'should open the dropdown when the selected tag is clicked' , ( done ) => {
437
+ const vm = new Vue ( {
438
+ template : '<div><v-select :options="options" :value="value"></v-select></div>' ,
439
+ components : { vSelect} ,
440
+ data : {
441
+ value : [ { label : 'one' } ] ,
442
+ options : [ { label : 'one' } ]
443
+ }
444
+ } ) . $mount ( )
445
+
446
+ const selectedTag = vm . $children [ 0 ] . $el . getElementsByClassName ( 'selected-tag' ) [ 0 ]
447
+ vm . $children [ 0 ] . toggleDropdown ( { target : selectedTag } )
448
+ Vue . nextTick ( ( ) => {
449
+ Vue . nextTick ( ( ) => {
450
+ expect ( vm . $children [ 0 ] . open ) . toEqual ( true )
451
+ done ( )
452
+ } )
453
+ } )
454
+ } )
455
+
436
456
it ( 'can close the dropdown when the el is clicked' , ( done ) => {
437
457
const vm = new Vue ( {
438
458
template : '<div><v-select></v-select></div>' ,
You can’t perform that action at this time.
0 commit comments