File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,6 +172,20 @@ describe('file-attachment', function () {
172172 assert . equal ( dragEvent , event )
173173 assert . equal ( true , event . defaultPrevented )
174174 } )
175+
176+ it ( 'attaches the correct file when browser sends multiple data transfer items with image as type' , async function ( ) {
177+ const listener = once ( 'file-attachment-accepted' )
178+
179+ const dataTransfer = new DataTransfer ( )
180+ const file = new File ( [ 'hubot' ] , 'test.png' , { type : 'image/png' } )
181+ dataTransfer . items . add ( 'some string' , 'image/jpeg' )
182+ dataTransfer . items . add ( file )
183+ const dropEvent = new ClipboardEvent ( 'paste' , { bubbles : true , clipboardData : dataTransfer } )
184+ fileAttachment . dispatchEvent ( dropEvent )
185+
186+ const event = await listener
187+ assert . equal ( 'test.png' , event . detail . attachments [ 0 ] . file . name )
188+ } )
175189 } )
176190} )
177191
You can’t perform that action at this time.
0 commit comments