* createDtWithFiles creates a mock data transfer object that can be used for drop events * @param {File[]} files * @param {object} options * @param {boolean} options.emptyTypes - If true, sets item types to empty string (simulates Chrome drag behavior)
(files = [], options = {})
| 3780 | * @param {boolean} options.emptyTypes - If true, sets item types to empty string (simulates Chrome drag behavior) |
| 3781 | */ |
| 3782 | function createDtWithFiles(files = [], options = {}) { |
| 3783 | const { emptyTypes = false } = options; |
| 3784 | return { |
| 3785 | dataTransfer: { |
| 3786 | files, |
| 3787 | items: files.map((file) => ({ |
| 3788 | kind: "file", |
| 3789 | size: file.size, |
| 3790 | type: emptyTypes ? "" : file.type, |
| 3791 | getAsFile: () => file, |
| 3792 | })), |
| 3793 | types: ["Files"], |
| 3794 | }, |
| 3795 | }; |
| 3796 | } |
| 3797 | |
| 3798 | /** |
| 3799 | * createFileSystemFileHandle creates a mock [FileSystemFileHandle](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle) |
no outgoing calls
no test coverage detected
searching dependent graphs…