This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/integration/components/widgets/quick-access-item-test.js

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: "&quot;quote&quot;" });
await render(
hbs`<MountWidget @widget="quick-access-item" @args={{this.args}} />`
);
const contentDiv = query(CONTENT_DIV_SELECTOR);
assert.strictEqual(contentDiv.innerText, '"quote"');
});
}
);