@@ -140,12 +140,28 @@ describe('PackageSelector', () => {
140140 } )
141141
142142 const input = component . find ( 'input' )
143- await input . setValue ( 'my-package ' )
143+ await input . setValue ( 'lodash ' )
144144 await input . trigger ( 'keydown' , { key : 'Enter' } )
145145
146146 const emitted = component . emitted ( 'update:modelValue' )
147147 expect ( emitted ) . toBeTruthy ( )
148- expect ( emitted ! [ 0 ] ! [ 0 ] ) . toEqual ( [ 'my-package' ] )
148+ expect ( emitted ! [ 0 ] ! [ 0 ] ) . toEqual ( [ 'lodash' ] )
149+ } )
150+
151+ it ( 'adds "no dep" entry on Enter key' , async ( ) => {
152+ const component = await mountSuspended ( PackageSelector , {
153+ props : {
154+ modelValue : [ ] ,
155+ } ,
156+ } )
157+
158+ const input = component . find ( 'input' )
159+ await input . setValue ( 'no dep' )
160+ await input . trigger ( 'keydown' , { key : 'Enter' } )
161+
162+ const emitted = component . emitted ( 'update:modelValue' )
163+ expect ( emitted ) . toBeTruthy ( )
164+ expect ( emitted ! [ 0 ] ! [ 0 ] ) . toEqual ( [ '__no_dependency__' ] )
149165 } )
150166
151167 it ( 'clears input after adding package' , async ( ) => {
@@ -156,7 +172,7 @@ describe('PackageSelector', () => {
156172 } )
157173
158174 const input = component . find ( 'input' )
159- await input . setValue ( 'my-package ' )
175+ await input . setValue ( 'lodash ' )
160176 await input . trigger ( 'keydown' , { key : 'Enter' } )
161177
162178 // Input should be cleared
0 commit comments