diff --git a/addon/components/category-nav/category.js b/addon/components/category-nav/category.js index 755d78d8..2a167440 100644 --- a/addon/components/category-nav/category.js +++ b/addon/components/category-nav/category.js @@ -91,7 +91,10 @@ export default class CategoryNavCategoryComponent extends Component { this.dragCounter = 0; this.isDragOver = false; - if (event.dataTransfer.files.length) { + if ( + event.dataTransfer.files.length && + !event.dataTransfer.getData("text") + ) { return await this.documents.upload( this.args.category, event.dataTransfer.files, @@ -104,7 +107,7 @@ export default class CategoryNavCategoryComponent extends Component { documentIds.map(async (id) => { const document = this.store.peekRecord("document", id); - if (document.category.id === this.args.category.id) { + if (!document || document.category.id === this.args.category.id) { return true; } diff --git a/addon/components/document-list-item.hbs b/addon/components/document-list-item.hbs index 04d1adff..c1d21281 100644 --- a/addon/components/document-list-item.hbs +++ b/addon/components/document-list-item.hbs @@ -26,6 +26,7 @@
documents.map((d) => d.id).join(","), - files: [], + // sometimes browser send a file as well (e.g. when dragging a thumbnail) - this should be ignored + files: [new File(["Thumbnail"], "test-file.txt")], }, }); @@ -91,7 +92,7 @@ module("Integration | Component | category-nav/category", function (hooks) { await triggerEvent("[data-test-drop]", "drop", { dataTransfer: { - getData: () => {}, + getData: () => "", files: [new File(["Ember Rules!"], "test-file.txt")], }, });