mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
DEV: Replace count
with qunit-dom (#29674)
This commit is contained in:
@ -3,7 +3,7 @@ import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender from "discourse/tests/helpers/create-pretender";
|
||||
import { count, createFile } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { createFile } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
const fakeUpload = {
|
||||
type: ".png",
|
||||
@ -48,8 +48,7 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {
|
||||
<ChatComposerUploads @existingUploads={{this.existingUploads}} @fileUploadElementId="chat-widget-uploader" />
|
||||
`);
|
||||
|
||||
assert.strictEqual(count(".chat-composer-upload"), 1);
|
||||
assert.dom(".chat-composer-upload").exists();
|
||||
assert.dom(".chat-composer-upload").exists({ count: 1 });
|
||||
});
|
||||
|
||||
test("upload starts and completes", async function (assert) {
|
||||
@ -130,9 +129,9 @@ module("Discourse Chat | Component | chat-composer-uploads", function (hooks) {
|
||||
);
|
||||
|
||||
await waitFor(".chat-composer-upload");
|
||||
assert.strictEqual(count(".chat-composer-upload"), 1);
|
||||
assert.dom(".chat-composer-upload").exists({ count: 1 });
|
||||
|
||||
await click(".chat-composer-upload__remove-btn");
|
||||
assert.strictEqual(count(".chat-composer-upload"), 0);
|
||||
assert.dom(".chat-composer-upload").doesNotExist();
|
||||
});
|
||||
});
|
||||
|
@ -33,9 +33,8 @@ module(
|
||||
});
|
||||
|
||||
test("when channel is a public channel", async function (assert) {
|
||||
const count = 10;
|
||||
this.channel = new ChatFabricators(getOwner(this)).channel();
|
||||
this.siteSettings.chat_channel_retention_days = count;
|
||||
this.siteSettings.chat_channel_retention_days = 10;
|
||||
|
||||
await render(
|
||||
hbs`<ChatRetentionReminderText @channel={{this.channel}} />`
|
||||
@ -43,7 +42,7 @@ module(
|
||||
|
||||
assert
|
||||
.dom(".chat-retention-reminder-text")
|
||||
.includesText(I18n.t("chat.retention_reminders.long", { count }));
|
||||
.includesText(I18n.t("chat.retention_reminders.long", { count: 10 }));
|
||||
|
||||
await render(
|
||||
hbs`<ChatRetentionReminderText @channel={{this.channel}} @type="short" />`
|
||||
@ -51,13 +50,12 @@ module(
|
||||
|
||||
assert
|
||||
.dom(".chat-retention-reminder-text")
|
||||
.includesText(I18n.t("chat.retention_reminders.short", { count }));
|
||||
.includesText(I18n.t("chat.retention_reminders.short", { count: 10 }));
|
||||
});
|
||||
|
||||
test("when channel is a DM channel", async function (assert) {
|
||||
const count = 10;
|
||||
this.channel = new ChatFabricators(getOwner(this)).directMessageChannel();
|
||||
this.siteSettings.chat_dm_retention_days = count;
|
||||
this.siteSettings.chat_dm_retention_days = 10;
|
||||
|
||||
await render(
|
||||
hbs`<ChatRetentionReminderText @channel={{this.channel}} />`
|
||||
@ -65,7 +63,7 @@ module(
|
||||
|
||||
assert
|
||||
.dom(".chat-retention-reminder-text")
|
||||
.includesText(I18n.t("chat.retention_reminders.long", { count }));
|
||||
.includesText(I18n.t("chat.retention_reminders.long", { count: 10 }));
|
||||
|
||||
await render(
|
||||
hbs`<ChatRetentionReminderText @channel={{this.channel}} @type="short" />`
|
||||
@ -73,7 +71,7 @@ module(
|
||||
|
||||
assert
|
||||
.dom(".chat-retention-reminder-text")
|
||||
.includesText(I18n.t("chat.retention_reminders.short", { count }));
|
||||
.includesText(I18n.t("chat.retention_reminders.short", { count: 10 }));
|
||||
});
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user