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/widgets/quick-access-item-test.js
Robin Ward f113648107
DEV: Migrate more tests to our Ember CLI format. (#11899)
This should be fully backwards compatible.

Co-authored-by: Jarek Radosz <jradosz@gmail.com>

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2021-02-01 09:01:47 -05:00

44 lines
1.2 KiB
JavaScript

import componentTest, {
setupRenderingTest,
} from "discourse/tests/helpers/component-test";
import {
discourseModule,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import hbs from "htmlbars-inline-precompile";
const CONTENT_DIV_SELECTOR = "li > a > div";
discourseModule(
"Integration | Component | Widget | quick-access-item",
function (hooks) {
setupRenderingTest(hooks);
componentTest("content attribute is escaped", {
template: hbs`{{mount-widget widget="quick-access-item" args=args}}`,
beforeEach() {
this.set("args", { content: "<b>bold</b>" });
},
test(assert) {
const contentDiv = queryAll(CONTENT_DIV_SELECTOR)[0];
assert.equal(contentDiv.innerText, "<b>bold</b>");
},
});
componentTest("escapedContent attribute is not escaped", {
template: hbs`{{mount-widget widget="quick-access-item" args=args}}`,
beforeEach() {
this.set("args", { escapedContent: "&quot;quote&quot;" });
},
test(assert) {
const contentDiv = queryAll(CONTENT_DIV_SELECTOR)[0];
assert.equal(contentDiv.innerText, '"quote"');
},
});
}
);