-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: Do not escape
fancy_title
again. (#8095)
`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.
- Loading branch information
Showing
3 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
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"'); | ||
} | ||
}); |