diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js index 773e8bbae59..d0a0847c710 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js @@ -8,7 +8,7 @@ import bootbox from "bootbox"; import { authorizedExtensions } from "discourse/lib/uploads"; import { click, fillIn, visit } from "@ember/test-helpers"; import I18n from "I18n"; -import { test } from "qunit"; +import { skip, test } from "qunit"; function pretender(server, helper) { server.post("/uploads/lookup-urls", () => { @@ -141,47 +141,47 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) { appEvents.trigger("composer:add-files", [jsonFile]); }); - // Had to comment this out for now; it works fine in Ember CLI but lagging + // TODO: Had to comment this out for now; it works fine in Ember CLI but lagging // UI updates sink it for the old Ember for some reason. Will re-enable // when we make Ember CLI the primary. - // - // test("cancelling uploads clears the placeholders out", async function (assert) { - // await visit("/"); - // await click("#create-topic"); - // await fillIn(".d-editor-input", "The image:\n"); - // const appEvents = loggedInUser().appEvents; - // const done = assert.async(); - // appEvents.on("composer:uploads-cancelled", () => { - // assert.strictEqual( - // queryAll(".d-editor-input").val(), - // "The image:\n", - // "it should clear the cancelled placeholders" - // ); - // done(); - // }); + skip("cancelling uploads clears the placeholders out", async function (assert) { + await visit("/"); + await click("#create-topic"); + await fillIn(".d-editor-input", "The image:\n"); + const appEvents = loggedInUser().appEvents; + const done = assert.async(); - // let uploadStarted = 0; - // appEvents.on("composer:upload-started", async () => { - // uploadStarted++; + appEvents.on("composer:uploads-cancelled", () => { + assert.strictEqual( + queryAll(".d-editor-input").val(), + "The image:\n", + "it should clear the cancelled placeholders" + ); + done(); + }); - // if (uploadStarted === 2) { - // assert.strictEqual( - // queryAll(".d-editor-input").val(), - // "The image:\n[Uploading: avatar.png...]()\n[Uploading: avatar2.png...]()\n", - // "it should show the upload placeholders when the upload starts" - // ); - // } - // }); + let uploadStarted = 0; + appEvents.on("composer:upload-started", async () => { + uploadStarted++; - // appEvents.on("composer:uploads-preprocessing-complete", async () => { - // await click("#cancel-file-upload"); - // }); + if (uploadStarted === 2) { + assert.strictEqual( + queryAll(".d-editor-input").val(), + "The image:\n[Uploading: avatar.png...]()\n[Uploading: avatar2.png...]()\n", + "it should show the upload placeholders when the upload starts" + ); + } + }); - // const image = createFile("avatar.png"); - // const image2 = createFile("avatar2.png"); - // appEvents.trigger("composer:add-files", [image, image2]); - // }); + appEvents.on("composer:uploads-preprocessing-complete", async () => { + await click("#cancel-file-upload"); + }); + + const image = createFile("avatar.png"); + const image2 = createFile("avatar2.png"); + appEvents.trigger("composer:add-files", [image, image2]); + }); }); acceptance("Uppy Composer Attachment - Upload Error", function (needs) {