mirror of
https://github.com/discourse/discourse.git
synced 2024-12-23 03:23:44 +08:00
b81055a6d4
…to either qunit-dom or `strictEqual`
42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
import { render } from "@ember/test-helpers";
|
|
import { module, test } from "qunit";
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import tonableEmojiTitle from "discourse/plugins/chat/discourse/helpers/tonable-emoji-title";
|
|
|
|
module(
|
|
"Discourse Chat | Unit | Helpers | tonable-emoji-title",
|
|
function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test("When emoji is not tonable", async function (assert) {
|
|
const emoji = { name: "foo", tonable: false };
|
|
const diversity = 1;
|
|
await render(<template>
|
|
<span>{{tonableEmojiTitle emoji diversity}}</span>
|
|
</template>);
|
|
|
|
assert.dom("span").hasText(":foo:");
|
|
});
|
|
|
|
test("When emoji is tonable and diversity is 1", async function (assert) {
|
|
const emoji = { name: "foo", tonable: true };
|
|
const diversity = 1;
|
|
await render(<template>
|
|
<span>{{tonableEmojiTitle emoji diversity}}</span>
|
|
</template>);
|
|
|
|
assert.dom("span").hasText(":foo:");
|
|
});
|
|
|
|
test("When emoji is tonable and diversity is greater than 1", async function (assert) {
|
|
const emoji = { name: "foo", tonable: true };
|
|
const diversity = 2;
|
|
await render(<template>
|
|
<span>{{tonableEmojiTitle emoji diversity}}</span>
|
|
</template>);
|
|
|
|
assert.dom("span").hasText(":foo:t2:");
|
|
});
|
|
}
|
|
);
|