mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 03:03:45 +08:00
f0f03acb2c
`fancy_title` is already escaped by Rails. Escaping it again would print the HTML entity as-is, e.g. `"` instead of `"`. This fixes the issue by introducing a new `escapedContent` attribute on the `QuickAccessItem` widget.
32 lines
818 B
JavaScript
32 lines
818 B
JavaScript
import { moduleForWidget, widgetTest } from "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 = find(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 = find(CONTENT_DIV_SELECTOR)[0];
|
|
assert.equal(contentDiv.innerText, '"quote"');
|
|
}
|
|
});
|