mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 22:26:10 +08:00
DEV: Convert assert.true(exists())
to qunit-dom (#29638)
This commit is contained in:
parent
3a23ff98bc
commit
c1916f7984
@ -47,7 +47,7 @@ acceptance("Composer - Messages", function (needs) {
|
||||
|
||||
await triggerKeyEvent(".d-editor-input", "keyup", "Space");
|
||||
|
||||
assert.true(exists(".composer-popup"), "shows composer warning message");
|
||||
assert.dom(".composer-popup").exists("shows composer warning message");
|
||||
|
||||
assert.true(
|
||||
query(".composer-popup").innerHTML.includes(
|
||||
@ -101,7 +101,7 @@ acceptance("Composer - Messages - Cannot see group", function (needs) {
|
||||
);
|
||||
|
||||
await fillIn(".d-editor-input", "Mention @staff");
|
||||
assert.true(exists(".composer-popup"), "shows composer warning message");
|
||||
assert.dom(".composer-popup").exists("shows composer warning message");
|
||||
assert.true(
|
||||
query(".composer-popup").innerHTML.includes(
|
||||
I18n.t("composer.cannot_see_group_mention.not_allowed", {
|
||||
@ -121,7 +121,7 @@ acceptance("Composer - Messages - Cannot see group", function (needs) {
|
||||
);
|
||||
|
||||
await fillIn(".d-editor-input", "Mention @staff2");
|
||||
assert.true(exists(".composer-popup"), "shows composer warning message");
|
||||
assert.dom(".composer-popup").exists("shows composer warning message");
|
||||
assert.true(
|
||||
query(".composer-popup").innerHTML.includes(
|
||||
I18n.t("composer.cannot_see_group_mention.some_not_allowed", {
|
||||
@ -242,7 +242,7 @@ acceptance("Composer - Messages - Private Messages", function (needs) {
|
||||
|
||||
await triggerKeyEvent(".d-editor-input", "keyup", "Space");
|
||||
|
||||
assert.true(exists(".composer-popup"), "shows composer warning message");
|
||||
assert.dom(".composer-popup").exists("shows composer warning message");
|
||||
assert.true(
|
||||
query(".composer-popup").innerHTML.includes(
|
||||
I18n.t("composer.yourself_confirm.title")
|
||||
|
@ -141,10 +141,9 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {
|
||||
".sidebar-section[data-section-name='categories'] .sidebar-section-header-button"
|
||||
);
|
||||
|
||||
assert.true(
|
||||
exists(".sidebar-categories-form"),
|
||||
"it shows the categories form modal"
|
||||
);
|
||||
assert
|
||||
.dom(".sidebar-categories-form")
|
||||
.exists("shows the categories form modal");
|
||||
});
|
||||
|
||||
test("categories section is shown with site's top categories when user has not added any categories and there are no default categories set for the user", async function (assert) {
|
||||
|
@ -4,7 +4,6 @@ import { click, fillIn, render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import widgetHbs from "discourse/widgets/hbs-compiler";
|
||||
import RenderGlimmer, {
|
||||
registerWidgetShim,
|
||||
@ -169,8 +168,8 @@ module("Integration | Component | Widget | render-glimmer", function (hooks) {
|
||||
<MountWidget @widget="demo-widget" @args={{hash arg1="val1" dynamicArg=this.dynamicValue}} />`
|
||||
);
|
||||
|
||||
assert.true(exists("div.my-widget"), "widget is rendered");
|
||||
assert.true(exists("div.glimmer-content"), "glimmer content is rendered");
|
||||
assert.dom("div.my-widget").exists("widget is rendered");
|
||||
assert.dom("div.glimmer-content").exists("glimmer content is rendered");
|
||||
assert
|
||||
.dom("div.glimmer-content")
|
||||
.hasText("arg1=val1 dynamicArg=", "arguments are passed through");
|
||||
@ -200,9 +199,9 @@ module("Integration | Component | Widget | render-glimmer", function (hooks) {
|
||||
{{/unless}}`
|
||||
);
|
||||
|
||||
assert.true(exists("div.my-widget"), "widget is rendered");
|
||||
assert.true(exists("div.glimmer-content"), "glimmer content is rendered");
|
||||
assert.true(exists("div.demo-component"), "demo component is rendered");
|
||||
assert.dom("div.my-widget").exists("widget is rendered");
|
||||
assert.dom("div.glimmer-content").exists("glimmer content is rendered");
|
||||
assert.dom("div.demo-component").exists("demo component is rendered");
|
||||
|
||||
assert.deepEqual(
|
||||
DemoComponent.eventLog,
|
||||
@ -261,10 +260,9 @@ module("Integration | Component | Widget | render-glimmer", function (hooks) {
|
||||
{{/unless}}`
|
||||
);
|
||||
|
||||
assert.true(
|
||||
exists("div.demo-component button"),
|
||||
"component button is rendered"
|
||||
);
|
||||
assert
|
||||
.dom("div.demo-component button")
|
||||
.exists("component button is rendered");
|
||||
|
||||
await click("div.demo-component button");
|
||||
assert.true(DemoWidget.actionTriggered, "widget event is triggered");
|
||||
@ -284,10 +282,9 @@ module("Integration | Component | Widget | render-glimmer", function (hooks) {
|
||||
.dom(".action-state")
|
||||
.hasText("false", "eventTriggered is false in nested component");
|
||||
|
||||
assert.true(
|
||||
exists("div.demo-component button"),
|
||||
"component button is rendered"
|
||||
);
|
||||
assert
|
||||
.dom("div.demo-component button")
|
||||
.exists("component button is rendered");
|
||||
|
||||
await click("div.demo-component button");
|
||||
assert.true(DemoWidget.actionTriggered, "widget event is triggered");
|
||||
|
@ -42,7 +42,7 @@ module("Discourse Chat | Component | <ChannelIcon />", function (hooks) {
|
||||
|
||||
await render(<template><ChannelIcon @channel={{channel}} /></template>);
|
||||
|
||||
assert.true(exists(".d-icon-lock"));
|
||||
assert.dom(".d-icon-lock").exists();
|
||||
});
|
||||
|
||||
test("category channel - not read restricted", async function (assert) {
|
||||
@ -67,7 +67,7 @@ module("Discourse Chat | Component | <ChannelIcon />", function (hooks) {
|
||||
|
||||
await render(<template><ChannelIcon @channel={{channel}} /></template>);
|
||||
|
||||
assert.true(exists(`.chat-user-avatar .avatar[title="${user.username}"]`));
|
||||
assert.dom(`.chat-user-avatar .avatar[title="${user.username}"]`).exists();
|
||||
});
|
||||
|
||||
test("dm channel - multiple users", async function (assert) {
|
||||
|
@ -114,7 +114,7 @@ module("Discourse Chat | Component | <ChannelName />", function (hooks) {
|
||||
<ChannelName @channel={{channel}} @unreadIndicator={{unreadIndicator}} />
|
||||
</template>);
|
||||
|
||||
assert.true(exists(".chat-channel-unread-indicator"));
|
||||
assert.dom(".chat-channel-unread-indicator").exists();
|
||||
|
||||
unreadIndicator = false;
|
||||
await render(<template>
|
||||
|
@ -36,14 +36,14 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {
|
||||
this.channel.status = "closed";
|
||||
await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);
|
||||
|
||||
assert.true(exists(".chat-channel-card.--closed"));
|
||||
assert.dom(".chat-channel-card.--closed").exists();
|
||||
});
|
||||
|
||||
test("Archived channel", async function (assert) {
|
||||
this.channel.status = "archived";
|
||||
await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);
|
||||
|
||||
assert.true(exists(".chat-channel-card.--archived"));
|
||||
assert.dom(".chat-channel-card.--archived").exists();
|
||||
});
|
||||
|
||||
test("Muted channel", async function (assert) {
|
||||
@ -51,19 +51,19 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {
|
||||
this.channel.currentUserMembership.following = true;
|
||||
await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);
|
||||
|
||||
assert.true(exists(".chat-channel-card__muted"));
|
||||
assert.dom(".chat-channel-card__muted").exists();
|
||||
});
|
||||
|
||||
test("Joined channel", async function (assert) {
|
||||
this.channel.currentUserMembership.following = true;
|
||||
await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);
|
||||
assert.true(exists(".toggle-channel-membership-button.-leave"));
|
||||
assert.dom(".toggle-channel-membership-button.-leave").exists();
|
||||
});
|
||||
|
||||
test("Joinable channel", async function (assert) {
|
||||
await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);
|
||||
|
||||
assert.true(exists(".chat-channel-card__join-btn"));
|
||||
assert.dom(".chat-channel-card__join-btn").exists();
|
||||
});
|
||||
|
||||
test("Memberships count", async function (assert) {
|
||||
@ -101,6 +101,6 @@ module("Discourse Chat | Component | chat-channel-card", function (hooks) {
|
||||
test("Read restricted chatable", async function (assert) {
|
||||
this.channel.chatable.read_restricted = true;
|
||||
await render(hbs`<ChatChannelCard @channel={{this.channel}} />`);
|
||||
assert.true(exists(".d-icon-lock"));
|
||||
assert.dom(".d-icon-lock").exists();
|
||||
});
|
||||
});
|
||||
|
@ -35,10 +35,9 @@ module(
|
||||
"it shows the channel title"
|
||||
);
|
||||
|
||||
assert.true(
|
||||
exists(query(".chat-channel-icon.--category-badge")),
|
||||
"it shows the category hashtag badge"
|
||||
);
|
||||
assert
|
||||
.dom(".chat-channel-icon.--category-badge")
|
||||
.exists("shows the category hashtag badge");
|
||||
});
|
||||
|
||||
test("channel description", async function (assert) {
|
||||
@ -61,28 +60,25 @@ module(
|
||||
"no line is left for the channel description if there is none"
|
||||
);
|
||||
|
||||
assert.true(
|
||||
exists(".chat-channel-preview-card.-no-description"),
|
||||
"it adds a modifier class for styling"
|
||||
);
|
||||
assert
|
||||
.dom(".chat-channel-preview-card.-no-description")
|
||||
.exists("adds a modifier class for styling");
|
||||
});
|
||||
|
||||
test("join", async function (assert) {
|
||||
await render(hbs`<ChatChannelPreviewCard @channel={{this.channel}} />`);
|
||||
|
||||
assert.true(
|
||||
exists(".toggle-channel-membership-button.-join"),
|
||||
"it shows the join channel button"
|
||||
);
|
||||
assert
|
||||
.dom(".toggle-channel-membership-button.-join")
|
||||
.exists("shows the join channel button");
|
||||
});
|
||||
|
||||
test("browse all", async function (assert) {
|
||||
await render(hbs`<ChatChannelPreviewCard @channel={{this.channel}} />`);
|
||||
|
||||
assert.true(
|
||||
exists(".chat-channel-preview-card__browse-all"),
|
||||
"it shows a link to browse all channels"
|
||||
);
|
||||
assert
|
||||
.dom(".chat-channel-preview-card__browse-all")
|
||||
.exists("shows a link to browse all channels");
|
||||
});
|
||||
|
||||
test("closed channel", async function (assert) {
|
||||
|
@ -2,7 +2,6 @@ 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 } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
module("Discourse Chat | Component | chat-composer-dropdown", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@ -13,9 +12,9 @@ module("Discourse Chat | Component | chat-composer-dropdown", function (hooks) {
|
||||
await render(hbs`<ChatComposerDropdown @buttons={{this.buttons}} />`);
|
||||
await click(".chat-composer-dropdown__trigger-btn");
|
||||
|
||||
assert.true(exists(".chat-composer-dropdown__item.foo"));
|
||||
assert.true(
|
||||
exists(".chat-composer-dropdown__action-btn.foo .d-icon-xmark")
|
||||
);
|
||||
assert.dom(".chat-composer-dropdown__item.foo").exists();
|
||||
assert
|
||||
.dom(".chat-composer-dropdown__action-btn.foo .d-icon-xmark")
|
||||
.exists();
|
||||
});
|
||||
});
|
||||
|
@ -2,7 +2,6 @@ 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 } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
@ -17,7 +16,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.dom(".upload-progress[value='50']").exists();
|
||||
assert.dom(".uploading").hasText(I18n.t("uploading"));
|
||||
});
|
||||
|
||||
@ -30,8 +29,8 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
|
||||
await render(hbs`<ChatComposerUpload @upload={{this.upload}} />`);
|
||||
|
||||
assert.true(exists(".d-icon-far-image"));
|
||||
assert.true(exists(".upload-progress[value=78]"));
|
||||
assert.dom(".d-icon-far-image").exists();
|
||||
assert.dom(".upload-progress[value='78']").exists();
|
||||
assert.dom(".uploading").hasText(I18n.t("uploading"));
|
||||
});
|
||||
|
||||
@ -59,7 +58,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
hbs`<ChatComposerUpload @isDone={{true}} @upload={{this.upload}} />`
|
||||
);
|
||||
|
||||
assert.true(exists(".d-icon-file-lines"));
|
||||
assert.dom(".d-icon-file-lines").exists();
|
||||
assert.dom(".file-name").hasText("some file.pdf");
|
||||
assert.dom(".extension-pill").hasText("pdf");
|
||||
});
|
||||
@ -76,7 +75,7 @@ module("Discourse Chat | Component | chat-composer-upload", function (hooks) {
|
||||
hbs`<ChatComposerUpload @isDone={{true}} @upload={{this.upload}} />`
|
||||
);
|
||||
|
||||
assert.true(exists("img.preview-img[src='/images/avatar.png']"));
|
||||
assert.dom("img.preview-img[src='/images/avatar.png']").exists();
|
||||
});
|
||||
|
||||
test("removing completed upload", async function (assert) {
|
||||
|
@ -2,7 +2,6 @@ import { 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 } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
module("Discourse Chat | Component | chat-emoji-avatar", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@ -12,10 +11,10 @@ module("Discourse Chat | Component | chat-emoji-avatar", function (hooks) {
|
||||
|
||||
await render(hbs`<ChatEmojiAvatar @emoji={{this.emoji}} />`);
|
||||
|
||||
assert.true(
|
||||
exists(
|
||||
`.chat-emoji-avatar .chat-emoji-avatar-container .emoji[title=otter]`
|
||||
assert
|
||||
.dom(
|
||||
".chat-emoji-avatar .chat-emoji-avatar-container .emoji[title=otter]"
|
||||
)
|
||||
);
|
||||
.exists();
|
||||
});
|
||||
});
|
||||
|
@ -3,7 +3,6 @@ import { 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 } from "discourse/tests/helpers/qunit-helpers";
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";
|
||||
|
||||
@ -33,6 +32,6 @@ module("Discourse Chat | Component | chat-message-avatar", function (hooks) {
|
||||
|
||||
await render(hbs`<Chat::Message::Avatar @message={{this.message}} />`);
|
||||
|
||||
assert.true(exists('.chat-user-avatar [data-user-card="discobot"]'));
|
||||
assert.dom('.chat-user-avatar [data-user-card="discobot"]').exists();
|
||||
});
|
||||
});
|
||||
|
@ -4,7 +4,7 @@ import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import Bookmark from "discourse/models/bookmark";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { exists, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";
|
||||
@ -52,7 +52,7 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
|
||||
|
||||
await render(template);
|
||||
|
||||
assert.true(exists(".chat-message-info__date"));
|
||||
assert.dom(".chat-message-info__date").exists();
|
||||
});
|
||||
|
||||
test("bookmark (with reminder)", async function (assert) {
|
||||
@ -66,9 +66,9 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
|
||||
|
||||
await render(template);
|
||||
|
||||
assert.true(
|
||||
exists(".chat-message-info__bookmark .d-icon-discourse-bookmark-clock")
|
||||
);
|
||||
assert
|
||||
.dom(".chat-message-info__bookmark .d-icon-discourse-bookmark-clock")
|
||||
.exists();
|
||||
});
|
||||
|
||||
test("bookmark (no reminder)", async function (assert) {
|
||||
@ -84,7 +84,7 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
|
||||
|
||||
await render(template);
|
||||
|
||||
assert.true(exists(".chat-message-info__bookmark .d-icon-bookmark"));
|
||||
assert.dom(".chat-message-info__bookmark .d-icon-bookmark").exists();
|
||||
});
|
||||
|
||||
test("user status", async function (assert) {
|
||||
@ -95,7 +95,7 @@ module("Discourse Chat | Component | chat-message-info", function (hooks) {
|
||||
|
||||
await render(template);
|
||||
|
||||
assert.true(exists(".chat-message-info__status .user-status-message"));
|
||||
assert.dom(".chat-message-info__status .user-status-message").exists();
|
||||
});
|
||||
|
||||
test("flag status", async function (assert) {
|
||||
|
@ -12,13 +12,13 @@ module("Discourse Chat | Component | chat-message-reaction", function (hooks) {
|
||||
<ChatMessageReaction @reaction={{hash emoji="heart" reacted=true}} />
|
||||
`);
|
||||
|
||||
assert.true(exists(".chat-message-reaction.reacted"));
|
||||
assert.dom(".chat-message-reaction.reacted").exists();
|
||||
});
|
||||
|
||||
test("adds reaction name as class", async function (assert) {
|
||||
await render(hbs`<ChatMessageReaction @reaction={{hash emoji="heart"}} />`);
|
||||
|
||||
assert.true(exists(`.chat-message-reaction[data-emoji-name="heart"]`));
|
||||
assert.dom(`.chat-message-reaction[data-emoji-name="heart"]`).exists();
|
||||
});
|
||||
|
||||
test("title/alt attributes", async function (assert) {
|
||||
|
@ -4,7 +4,7 @@ import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import CoreFabricators from "discourse/lib/fabricators";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { exists, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
|
||||
module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
@ -20,7 +20,7 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
});
|
||||
await render(template);
|
||||
|
||||
assert.true(exists(".chat-message-edited"), "has the correct css class");
|
||||
assert.dom(".chat-message-edited").exists("has the correct css class");
|
||||
});
|
||||
|
||||
test("Deleted message", async function (assert) {
|
||||
@ -30,10 +30,9 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
});
|
||||
await render(template);
|
||||
|
||||
assert.true(
|
||||
exists(".chat-message-text.-deleted .chat-message-expand"),
|
||||
"has the correct css class and expand button within"
|
||||
);
|
||||
assert
|
||||
.dom(".chat-message-text.-deleted .chat-message-expand")
|
||||
.exists("has the correct css class and expand button within");
|
||||
});
|
||||
|
||||
test("Hidden message", async function (assert) {
|
||||
@ -42,10 +41,9 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
});
|
||||
await render(template);
|
||||
|
||||
assert.true(
|
||||
exists(".chat-message-text.-hidden .chat-message-expand"),
|
||||
"has the correct css class and expand button within"
|
||||
);
|
||||
assert
|
||||
.dom(".chat-message-text.-hidden .chat-message-expand")
|
||||
.exists("has the correct css class and expand button within");
|
||||
});
|
||||
|
||||
test("Message by a bot", async function (assert) {
|
||||
@ -79,10 +77,9 @@ module("Discourse Chat | Component | chat-message", function (hooks) {
|
||||
});
|
||||
await render(template);
|
||||
|
||||
assert.true(
|
||||
exists(".chat-message-container.has-reply"),
|
||||
"has the correct css class"
|
||||
);
|
||||
assert
|
||||
.dom(".chat-message-container.has-reply")
|
||||
.exists("has the correct css class");
|
||||
});
|
||||
|
||||
test("Message with streaming", async function (assert) {
|
||||
|
@ -16,7 +16,7 @@ module("Discourse Chat | Component | chat-message-text", function (hooks) {
|
||||
</ChatMessageText>
|
||||
`);
|
||||
|
||||
assert.true(exists(".yield-me"));
|
||||
assert.dom(".yield-me").exists();
|
||||
});
|
||||
|
||||
test("shows collapsed", async function (assert) {
|
||||
@ -29,7 +29,7 @@ module("Discourse Chat | Component | chat-message-text", function (hooks) {
|
||||
hbs`<ChatMessageText @cooked={{this.cooked}} @uploads={{this.uploads}} />`
|
||||
);
|
||||
|
||||
assert.true(exists(".chat-message-collapser"));
|
||||
assert.dom(".chat-message-collapser").exists();
|
||||
});
|
||||
|
||||
test("does not collapse a non-image onebox", async function (assert) {
|
||||
@ -47,7 +47,7 @@ module("Discourse Chat | Component | chat-message-text", function (hooks) {
|
||||
hbs`<ChatMessageText @cooked={{this.cooked}} @edited={{true}} />`
|
||||
);
|
||||
|
||||
assert.true(exists(".chat-message-edited"));
|
||||
assert.dom(".chat-message-edited").exists();
|
||||
});
|
||||
|
||||
test("shows edits - collapsible message", async function (assert) {
|
||||
@ -60,6 +60,6 @@ module("Discourse Chat | Component | chat-message-text", function (hooks) {
|
||||
hbs`<ChatMessageText @cooked={{this.cooked}} @edited={{true}} />`
|
||||
);
|
||||
|
||||
assert.true(exists(".chat-message-edited"));
|
||||
assert.dom(".chat-message-edited").exists();
|
||||
});
|
||||
});
|
||||
|
@ -2,7 +2,7 @@ import { render, settled } 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 { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
const IMAGE_FIXTURE = {
|
||||
id: 290,
|
||||
@ -73,7 +73,7 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {
|
||||
|
||||
await render(hbs`<ChatUpload @upload={{this.upload}} />`);
|
||||
|
||||
assert.true(exists("img.chat-img-upload"), "displays as an image");
|
||||
assert.dom("img.chat-img-upload").exists("displays as an image");
|
||||
const image = query("img.chat-img-upload");
|
||||
assert.strictEqual(image.loading, "lazy", "is lazy loading");
|
||||
|
||||
@ -98,7 +98,7 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {
|
||||
|
||||
await render(hbs`<ChatUpload @upload={{this.upload}} />`);
|
||||
|
||||
assert.true(exists("video.chat-video-upload"), "displays as an video");
|
||||
assert.dom("video.chat-video-upload").exists("displays as an video");
|
||||
assert.dom("video.chat-video-upload").hasAttribute("controls");
|
||||
assert
|
||||
.dom("video.chat-video-upload")
|
||||
@ -114,7 +114,7 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {
|
||||
|
||||
await render(hbs`<ChatUpload @upload={{this.upload}} />`);
|
||||
|
||||
assert.true(exists("audio.chat-audio-upload"), "displays as an audio");
|
||||
assert.dom("audio.chat-audio-upload").exists("displays as an audio");
|
||||
assert.dom("audio.chat-audio-upload").hasAttribute("controls");
|
||||
assert
|
||||
.dom("audio.chat-audio-upload")
|
||||
@ -130,7 +130,7 @@ module("Discourse Chat | Component | chat-upload", function (hooks) {
|
||||
|
||||
await render(hbs`<ChatUpload @upload={{this.upload}} />`);
|
||||
|
||||
assert.true(exists("a.chat-other-upload"), "displays as a link");
|
||||
assert.dom("a.chat-other-upload").exists("displays as a link");
|
||||
const link = query("a.chat-other-upload");
|
||||
assert.strictEqual(link.href, TXT_FIXTURE.url, "has the correct URL");
|
||||
});
|
||||
|
@ -3,7 +3,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, visible } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { visible } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
module("Discourse Chat | Component | collapser", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@ -13,7 +13,7 @@ module("Discourse Chat | Component | collapser", function (hooks) {
|
||||
|
||||
await render(hbs`<Collapser @header={{this.header}} />`);
|
||||
|
||||
assert.true(exists(".cat"));
|
||||
assert.dom(".cat").exists();
|
||||
});
|
||||
|
||||
test("collapses and expands yielded body", async function (assert) {
|
||||
|
@ -10,26 +10,26 @@ module("Discourse Chat | Component | dc-filter-input", function (hooks) {
|
||||
test("Left icon", async function (assert) {
|
||||
await render(hbs`<DcFilterInput @icons={{hash left="bell"}} />`);
|
||||
|
||||
assert.true(exists(".d-icon-bell.-left"));
|
||||
assert.dom(".d-icon-bell.-left").exists();
|
||||
});
|
||||
|
||||
test("Right icon", async function (assert) {
|
||||
await render(hbs`<DcFilterInput @icons={{hash right="bell"}} />`);
|
||||
|
||||
assert.true(exists(".d-icon-bell.-right"));
|
||||
assert.dom(".d-icon-bell.-right").exists();
|
||||
});
|
||||
|
||||
test("containerClass argument", async function (assert) {
|
||||
await render(hbs`<DcFilterInput @containerClass="foo" />`);
|
||||
|
||||
assert.true(exists(".dc-filter-input-container.foo"));
|
||||
assert.dom(".dc-filter-input-container.foo").exists();
|
||||
});
|
||||
|
||||
test("Html attributes", async function (assert) {
|
||||
await render(hbs`<DcFilterInput data-foo="1" placeholder="bar" />`);
|
||||
|
||||
assert.true(exists('.dc-filter-input[data-foo="1"]'));
|
||||
assert.true(exists('.dc-filter-input[placeholder="bar"]'));
|
||||
assert.dom('.dc-filter-input[data-foo="1"]').exists();
|
||||
assert.dom('.dc-filter-input[placeholder="bar"]').exists();
|
||||
});
|
||||
|
||||
test("Filter action", async function (assert) {
|
||||
@ -47,7 +47,7 @@ module("Discourse Chat | Component | dc-filter-input", function (hooks) {
|
||||
await render(hbs`<DcFilterInput @filterAction={{this.action}} />`);
|
||||
await triggerEvent(".dc-filter-input", "focusin");
|
||||
|
||||
assert.true(exists(".dc-filter-input-container.is-focused"));
|
||||
assert.dom(".dc-filter-input-container.is-focused").exists();
|
||||
|
||||
await triggerEvent(".dc-filter-input", "focusout");
|
||||
|
||||
|
@ -3,7 +3,7 @@ import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import { exists, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
module(
|
||||
@ -21,7 +21,7 @@ module(
|
||||
|
||||
test("empty state when there are no notifications", async function (assert) {
|
||||
await render(template);
|
||||
assert.true(exists(".empty-state .empty-state-body"));
|
||||
assert.dom(".empty-state .empty-state-body").exists();
|
||||
assert.strictEqual(
|
||||
query(".empty-state .empty-state-title").textContent.trim(),
|
||||
I18n.t("user_menu.no_chat_notifications_title")
|
||||
|
@ -3,7 +3,6 @@ import { test } from "qunit";
|
||||
import { AUTO_GROUPS } from "discourse/lib/constants";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
@ -34,24 +33,21 @@ acceptance("Poll Builder - polls are enabled", function (needs) {
|
||||
|
||||
await click(pollBuilderButtonSelector);
|
||||
|
||||
assert.true(
|
||||
exists(".poll-type-value-regular.active"),
|
||||
"regular type is active"
|
||||
);
|
||||
assert
|
||||
.dom(".poll-type-value-regular.active")
|
||||
.exists("regular type is active");
|
||||
|
||||
await click(".poll-type-value-multiple");
|
||||
|
||||
assert.true(
|
||||
exists(".poll-type-value-multiple.active"),
|
||||
"multiple type is active"
|
||||
);
|
||||
assert
|
||||
.dom(".poll-type-value-multiple.active")
|
||||
.exists("multiple type is active");
|
||||
|
||||
await click(".poll-type-value-regular");
|
||||
|
||||
assert.true(
|
||||
exists(".poll-type-value-regular.active"),
|
||||
"regular type is active"
|
||||
);
|
||||
assert
|
||||
.dom(".poll-type-value-regular.active")
|
||||
.exists("regular type is active");
|
||||
});
|
||||
|
||||
test("regular user - insufficient trust level", async function (assert) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user