mirror of
https://github.com/discourse/discourse.git
synced 2024-12-25 01:13:51 +08:00
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:");
|
||
|
});
|
||
|
}
|
||
|
);
|