mirror of
https://ghfast.top/https://github.com/discourse/discourse-translator.git
synced 2026-07-16 11:46:33 +08:00
31 lines
1.1 KiB
Text
31 lines
1.1 KiB
Text
import { render } from "@ember/test-helpers";
|
|
import { module, test } from "qunit";
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import TranslatedPost from "discourse/plugins/discourse-translator/discourse/components/translated-post";
|
|
|
|
module("Integration | Component | translated-post", function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test("renders translation when post is translated", async function (assert) {
|
|
this.set("outletArgs", {
|
|
post: {
|
|
isTranslated: true,
|
|
isTranslating: false,
|
|
translatedText: "こんにちは",
|
|
translatedTitle: "良い一日",
|
|
detectedLang: "ja",
|
|
},
|
|
});
|
|
|
|
this.siteSettings.translator_provider = "Google";
|
|
|
|
await render(
|
|
<template><TranslatedPost @outletArgs={{this.outletArgs}} /></template>
|
|
);
|
|
|
|
assert.dom(".post-translation").exists();
|
|
assert.dom(".topic-attribution").hasText("良い一日");
|
|
assert.dom(".post-attribution").hasText("Translated from ja by Google");
|
|
assert.dom(".cooked").hasText("こんにちは");
|
|
});
|
|
});
|