mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 13:01:14 +08:00
DEV: Convert more test assertions to qunit-dom (#29214)
the PR is sponsored by vscode's regex support in find-and-replace 😉
This commit is contained in:
@ -2,7 +2,7 @@ import { click, render } from "@ember/test-helpers";
|
||||
import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { exists, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
@ -18,10 +18,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
await render(hbs`<ChatComposerUpload @upload={{this.upload}} />`);
|
||||
|
||||
assert.true(exists(".upload-progress[value=50]"));
|
||||
assert.strictEqual(
|
||||
query(".uploading").innerText.trim(),
|
||||
I18n.t("uploading")
|
||||
);
|
||||
assert.dom(".uploading").hasText(I18n.t("uploading"));
|
||||
});
|
||||
|
||||
test("image - uploading in progress", async function (assert) {
|
||||
@ -35,10 +32,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
|
||||
assert.true(exists(".d-icon-far-image"));
|
||||
assert.true(exists(".upload-progress[value=78]"));
|
||||
assert.strictEqual(
|
||||
query(".uploading").innerText.trim(),
|
||||
I18n.t("uploading")
|
||||
);
|
||||
assert.dom(".uploading").hasText(I18n.t("uploading"));
|
||||
});
|
||||
|
||||
test("image - preprocessing upload in progress", async function (assert) {
|
||||
@ -51,10 +45,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
|
||||
await render(hbs`<ChatComposerUpload @upload={{this.upload}} />`);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".processing").innerText.trim(),
|
||||
I18n.t("processing")
|
||||
);
|
||||
assert.dom(".processing").hasText(I18n.t("processing"));
|
||||
});
|
||||
|
||||
test("file - upload complete", async function (assert) {
|
||||
@ -69,8 +60,8 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
);
|
||||
|
||||
assert.true(exists(".d-icon-file-lines"));
|
||||
assert.strictEqual(query(".file-name").innerText.trim(), "some file.pdf");
|
||||
assert.strictEqual(query(".extension-pill").innerText.trim(), "pdf");
|
||||
assert.dom(".file-name").hasText("some file.pdf");
|
||||
assert.dom(".extension-pill").hasText("pdf");
|
||||
});
|
||||
|
||||
test("image - upload complete", async function (assert) {
|
||||
|
Reference in New Issue
Block a user