mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 19:48:50 +03:00
24 lines
495 B
JavaScript
24 lines
495 B
JavaScript
import {triggerEvent} from '@ember/test-helpers';
|
|
|
|
export function createFile(content = ['test'], options = {}) {
|
|
let {
|
|
name,
|
|
type
|
|
} = options;
|
|
|
|
let file = new Blob(content, {type: type ? type : 'text/plain'});
|
|
file.name = name ? name : 'test.txt';
|
|
|
|
return file;
|
|
}
|
|
|
|
export function fileUpload(target, content, options) {
|
|
let file = createFile(content, options);
|
|
|
|
return triggerEvent(
|
|
target,
|
|
'change',
|
|
{files: [file]}
|
|
);
|
|
}
|