mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 22:10:28 +08:00
dc3473fe06
1. `test()` and `render()` instead of `componentTest()` 2. Angle brackets 3. `strictEqual()`/`true()`/`false()` assertions This removes all remaining uses of `componentTest` from core
26 lines
929 B
JavaScript
26 lines
929 B
JavaScript
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import hbs from "htmlbars-inline-precompile";
|
|
import { exists, query } from "discourse/tests/helpers/qunit-helpers";
|
|
import { module, test } from "qunit";
|
|
import { render } from "@ember/test-helpers";
|
|
|
|
module("Discourse Chat | Component | chat-message-avatar", function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test("chat_webhook_event", async function (assert) {
|
|
this.set("message", { chat_webhook_event: { emoji: ":heart:" } });
|
|
|
|
await render(hbs`<ChatMessageAvatar @message={{this.message}} />`);
|
|
|
|
assert.strictEqual(query(".chat-emoji-avatar .emoji").title, "heart");
|
|
});
|
|
|
|
test("user", async function (assert) {
|
|
this.set("message", { user: { username: "discobot" } });
|
|
|
|
await render(hbs`<ChatMessageAvatar @message={{this.message}} />`);
|
|
|
|
assert.true(exists('.chat-user-avatar [data-user-card="discobot"]'));
|
|
});
|
|
});
|