DEV: use query() instead of queryAll() in tests (#15681)

This commit is contained in:
Andrei Prigorshnev 2022-01-24 01:27:58 +01:00 committed by GitHub
parent 1f2226270e
commit cd68279f5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 19 deletions

View File

@ -3,7 +3,6 @@ import {
createFile,
loggedInUser,
query,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import { withPluginApi } from "discourse/lib/plugin-api";
import bootbox from "bootbox";
@ -64,7 +63,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
appEvents.on("composer:all-uploads-complete", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
);
done();
@ -72,7 +71,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
appEvents.on("composer:upload-started", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"The image:\n[Uploading: avatar.png...]()\n"
);
});
@ -91,7 +90,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
const done = assert.async();
appEvents.on("composer:uploads-aborted", async () => {
assert.strictEqual(
queryAll(".bootbox .modal-body").html(),
query(".bootbox .modal-body").innerHTML,
I18n.t("post.errors.too_many_dragged_and_dropped_files", {
count: 2,
}),
@ -115,7 +114,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
appEvents.on("composer:uploads-aborted", async () => {
assert.strictEqual(
queryAll(".bootbox .modal-body").html(),
query(".bootbox .modal-body").innerHTML,
I18n.t("post.errors.upload_not_authorized", {
authorized_extensions: authorizedExtensions(
false,
@ -146,7 +145,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
appEvents.on("composer:uploads-cancelled", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"The image:\n",
"it should clear the cancelled placeholders"
);
@ -159,7 +158,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
if (uploadStarted === 2) {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"The image:\n[Uploading: avatar.png...]()\n[Uploading: avatar2.png...]()\n",
"it should show the upload placeholders when the upload starts"
);
@ -184,14 +183,14 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
appEvents.on("composer:upload-started", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"The image:\n[Uploading: avatar.png...]()\n"
);
});
appEvents.on("composer:all-uploads-complete", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
);
done();
@ -214,14 +213,14 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
appEvents.on("composer:upload-started", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"The image:\n[Uploading: avatar.png...]()\n Text after the image."
);
});
appEvents.on("composer:all-uploads-complete", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n Text after the image."
);
done();
@ -247,14 +246,14 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
appEvents.on("composer:upload-started", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"The image:\n[Uploading: avatar.png...]()\n Text after the image."
);
});
appEvents.on("composer:all-uploads-complete", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n Text after the image."
);
done();
@ -272,14 +271,14 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
appEvents.on("composer:upload-started", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"[Uploading: avatar.png...]()\n"
);
});
appEvents.on("composer:all-uploads-complete", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
);
done();
@ -298,14 +297,14 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
appEvents.on("composer:upload-started", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"The image:\n[Uploading: avatar.png...]()\n"
);
});
appEvents.on("composer:all-uploads-complete", () => {
assert.strictEqual(
queryAll(".d-editor-input").val(),
query(".d-editor-input").value,
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
);
done();
@ -341,7 +340,7 @@ acceptance("Uppy Composer Attachment - Upload Error", function (needs) {
appEvents.on("composer:upload-error", async () => {
assert.strictEqual(
queryAll(".bootbox .modal-body").html(),
query(".bootbox .modal-body").innerHTML,
"There was an error uploading the file, the gif was way too cool.",
"it should show the error message from the server"
);
@ -383,7 +382,7 @@ acceptance("Uppy Composer Attachment - Upload Handler", function (needs) {
appEvents.on("composer:uploads-aborted", async () => {
assert.strictEqual(
queryAll(".bootbox .modal-body").html(),
query(".bootbox .modal-body").innerHTML,
"This is an upload handler test for handlertest.png. The file WAS a native file object.",
"it should show the bootbox triggered by the upload handler"
);