@@ -414,8 +414,20 @@ describe('FilterInput', () => {
414
414
// assert the input and tags are emitted
415
415
expect ( wrapper . emitted ( 'input' ) ) . toHaveLength ( 1 ) ;
416
416
expect ( wrapper . emitted ( 'input' ) [ 0 ] ) . toEqual ( [ 'Title' ] ) ;
417
- expect ( wrapper . emitted ( 'update:selectedTags' ) ) . toHaveLength ( 1 ) ;
418
- expect ( wrapper . emitted ( 'update:selectedTags' ) [ 0 ] ) . toEqual ( [ [ ] ] ) ;
417
+ } ) ;
418
+
419
+ it ( 'on paste, do not emit selectedTags if there are no tags to paste' , ( ) => {
420
+ clipboardData . getData = jest . fn ( ( param ) => {
421
+ if ( param === 'text/plain' ) return 'Title' ;
422
+ return prepareDataForHTMLClipboard ( {
423
+ input : 'baz' ,
424
+ tags : [ ] ,
425
+ } ) ;
426
+ } ) ;
427
+ clipboardData . types . push ( 'text/html' ) ;
428
+
429
+ input . trigger ( 'paste' , { clipboardData } ) ;
430
+ expect ( wrapper . emitted ( 'update:selectedTags' ) ) . toBeFalsy ( ) ;
419
431
} ) ;
420
432
421
433
it ( 'on paste, reads directly from plain text, if json is not available' , ( ) => {
@@ -428,8 +440,6 @@ describe('FilterInput', () => {
428
440
// assert the input and tags are emitted
429
441
expect ( wrapper . emitted ( 'input' ) ) . toHaveLength ( 1 ) ;
430
442
expect ( wrapper . emitted ( 'input' ) [ 0 ] ) . toEqual ( [ '[tag1][tag2] string' ] ) ;
431
- expect ( wrapper . emitted ( 'update:selectedTags' ) ) . toHaveLength ( 1 ) ;
432
- expect ( wrapper . emitted ( 'update:selectedTags' ) [ 0 ] ) . toEqual ( [ [ ] ] ) ;
433
443
} ) ;
434
444
435
445
it ( 'on paste, overwrites all the tags if they are selected' , ( ) => {
0 commit comments