0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-18 23:01:11 +02:00
Dieser Commit ist enthalten in:
merefield 2024-05-29 15:54:34 +01:00
Ursprung 4ad6f331b3
Commit 9ec820fce8

Datei anzeigen

@ -1,5 +1,11 @@
import { getOwner } from "@ember/application"; import { getOwner } from "@ember/application";
import { click, fillIn, settled, triggerKeyEvent, visit } from "@ember/test-helpers"; import {
click,
fillIn,
settled,
triggerKeyEvent,
visit,
} from "@ember/test-helpers";
import { test } from "qunit"; import { test } from "qunit";
import { import {
acceptance, acceptance,
@ -23,22 +29,24 @@ acceptance("Field | Fields", function (needs) {
); );
server.get("/u/search/users", () => helper.response(usersJson)); server.get("/u/search/users", () => helper.response(usersJson));
server.post("/uploads.json", () => { server.post(
return helper.response({ "/uploads.json",
extension: "jpeg", () => {
filesize: 126177, return helper.response({
height: 800, extension: "jpeg",
human_filesize: "123 KB", filesize: 126177,
id: 202, height: 800,
original_filename: "avatar.PNG.jpg", human_filesize: "123 KB",
retain_hours: null, id: 202,
short_path: "/uploads/short-url/yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg", original_filename: "avatar.PNG.jpg",
short_url: "upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg", retain_hours: null,
thumbnail_height: 320, short_path: "/uploads/short-url/yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg",
thumbnail_width: 690, short_url: "upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg",
url: "/images/discourse-logo-sketch-small.png", thumbnail_height: 320,
width: 1920, thumbnail_width: 690,
}); url: "/images/discourse-logo-sketch-small.png",
width: 1920,
});
}, },
500 // this delay is important to slow down the uploads a bit so we can let elements of the interface update 500 // this delay is important to slow down the uploads a bit so we can let elements of the interface update
); );
@ -84,16 +92,22 @@ acceptance("Field | Fields", function (needs) {
const appEvents = getOwner(this).lookup("service:app-events"); const appEvents = getOwner(this).lookup("service:app-events");
const done = assert.async(); const done = assert.async();
appEvents.on(`${wizardComposerEdtiorEventPrefix}:all-uploads-complete`, async () => { appEvents.on(
await settled(); `${wizardComposerEdtiorEventPrefix}:all-uploads-complete`,
assert.ok(!exists(".wizard-btn.next.primary:disabled")); async () => {
done(); await settled();
}); assert.ok(!exists(".wizard-btn.next.primary:disabled"));
done();
}
);
appEvents.on(`${wizardComposerEdtiorEventPrefix}:upload-started`, async () => { appEvents.on(
await settled() `${wizardComposerEdtiorEventPrefix}:upload-started`,
assert.ok(exists(".wizard-btn.next.primary:disabled")); async () => {
}); await settled();
assert.ok(exists(".wizard-btn.next.primary:disabled"));
}
);
const image = createFile("avatar.png"); const image = createFile("avatar.png");
appEvents.trigger(`${wizardComposerEdtiorEventPrefix}:add-files`, image); appEvents.trigger(`${wizardComposerEdtiorEventPrefix}:add-files`, image);