0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-16 13:51:12 +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 { click, fillIn, settled, triggerKeyEvent, visit } from "@ember/test-helpers";
import {
click,
fillIn,
settled,
triggerKeyEvent,
visit,
} from "@ember/test-helpers";
import { test } from "qunit";
import {
acceptance,
@ -23,22 +29,24 @@ acceptance("Field | Fields", function (needs) {
);
server.get("/u/search/users", () => helper.response(usersJson));
server.post("/uploads.json", () => {
return helper.response({
extension: "jpeg",
filesize: 126177,
height: 800,
human_filesize: "123 KB",
id: 202,
original_filename: "avatar.PNG.jpg",
retain_hours: null,
short_path: "/uploads/short-url/yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg",
short_url: "upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg",
thumbnail_height: 320,
thumbnail_width: 690,
url: "/images/discourse-logo-sketch-small.png",
width: 1920,
});
server.post(
"/uploads.json",
() => {
return helper.response({
extension: "jpeg",
filesize: 126177,
height: 800,
human_filesize: "123 KB",
id: 202,
original_filename: "avatar.PNG.jpg",
retain_hours: null,
short_path: "/uploads/short-url/yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg",
short_url: "upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg",
thumbnail_height: 320,
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
);
@ -84,16 +92,22 @@ acceptance("Field | Fields", function (needs) {
const appEvents = getOwner(this).lookup("service:app-events");
const done = assert.async();
appEvents.on(`${wizardComposerEdtiorEventPrefix}:all-uploads-complete`, async () => {
await settled();
assert.ok(!exists(".wizard-btn.next.primary:disabled"));
done();
});
appEvents.on(
`${wizardComposerEdtiorEventPrefix}:all-uploads-complete`,
async () => {
await settled();
assert.ok(!exists(".wizard-btn.next.primary:disabled"));
done();
}
);
appEvents.on(`${wizardComposerEdtiorEventPrefix}:upload-started`, async () => {
await settled()
assert.ok(exists(".wizard-btn.next.primary:disabled"));
});
appEvents.on(
`${wizardComposerEdtiorEventPrefix}:upload-started`,
async () => {
await settled();
assert.ok(exists(".wizard-btn.next.primary:disabled"));
}
);
const image = createFile("avatar.png");
appEvents.trigger(`${wizardComposerEdtiorEventPrefix}:add-files`, image);