Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it( 'should not insert image when file is null', () => {
const viewDocument = editor.editing.view.document;
const dataTransfer = new DataTransfer( { files: [ null ], types: [ 'Files' ], getData: () => null } );
setModelData( model, 'foo[]' );
const targetRange = doc.selection.getFirstRange();
const targetViewRange = editor.editing.mapper.toViewRange( targetRange );
viewDocument.fire( 'clipboardInput', { dataTransfer, targetRanges: [ targetViewRange ] } );
expect( getModelData( model ) ).to.equal( 'foo[]' );
} );
function mockDataTransfer( content ) {
return new DataTransfer( {
types: [ 'text/html' ],
getData: type => type === 'text/html' ? content : ''
} );
}