See https://github.com/ember-cli/ember-cli-htmlbars#tagged-template-usage--migrating-from-htmlbars-inline-precompile
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
import { module, test } from "qunit";
|
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
|
import { render } from "@ember/test-helpers";
|
|
import { query } from "discourse/tests/helpers/qunit-helpers";
|
|
import { hbs } from "ember-cli-htmlbars";
|
|
|
|
const CONTENT_DIV_SELECTOR = "li > a > div";
|
|
|
|
module(
|
|
"Integration | Component | Widget | quick-access-item",
|
|
function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
|
|
test("content attribute is escaped", async function (assert) {
|
|
this.set("args", { content: "<b>bold</b>" });
|
|
|
|
await render(
|
|
hbs`<MountWidget @widget="quick-access-item" @args={{this.args}} />`
|
|
);
|
|
|
|
const contentDiv = query(CONTENT_DIV_SELECTOR);
|
|
assert.strictEqual(contentDiv.innerText, "<b>bold</b>");
|
|
});
|
|
|
|
test("escapedContent attribute is not escaped", async function (assert) {
|
|
this.set("args", { escapedContent: ""quote"" });
|
|
|
|
await render(
|
|
hbs`<MountWidget @widget="quick-access-item" @args={{this.args}} />`
|
|
);
|
|
|
|
const contentDiv = query(CONTENT_DIV_SELECTOR);
|
|
assert.strictEqual(contentDiv.innerText, '"quote"');
|
|
});
|
|
}
|
|
);
|