In newer Embers jQuery is removed. There is a `find` but it only returns one element and not a jQuery selector. This patch migrates our code to a new helper `queryAll` which allows us to remove the global.
36 lines
915 B
JavaScript
36 lines
915 B
JavaScript
import { queryAll } from "discourse/tests/helpers/qunit-helpers";
|
|
import {
|
|
moduleForWidget,
|
|
widgetTest,
|
|
} from "discourse/tests/helpers/widget-test";
|
|
|
|
moduleForWidget("quick-access-item");
|
|
|
|
const CONTENT_DIV_SELECTOR = "li > a > div";
|
|
|
|
widgetTest("content attribute is escaped", {
|
|
template: '{{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>");
|
|
},
|
|
});
|
|
|
|
widgetTest("escapedContent attribute is not escaped", {
|
|
template: '{{mount-widget widget="quick-access-item" args=args}}',
|
|
|
|
beforeEach() {
|
|
this.set("args", { escapedContent: ""quote"" });
|
|
},
|
|
|
|
test(assert) {
|
|
const contentDiv = queryAll(CONTENT_DIV_SELECTOR)[0];
|
|
assert.equal(contentDiv.innerText, '"quote"');
|
|
},
|
|
});
|