diff --git a/app/assets/javascripts/admin/templates/customize-themes-show.hbs b/app/assets/javascripts/admin/templates/customize-themes-show.hbs index 3ab5bf43ab2..21090a03e92 100644 --- a/app/assets/javascripts/admin/templates/customize-themes-show.hbs +++ b/app/assets/javascripts/admin/templates/customize-themes-show.hbs @@ -40,6 +40,7 @@

{{i18n "admin.customize.theme.color_scheme_select"}}

{{combo-box content=colorSchemes filterable=true + forceEscape=true value=colorSchemeId icon="paint-brush"}} {{#if colorSchemeChanged}} @@ -142,7 +143,7 @@ {{/unless}} {{#if selectableChildThemes}}

- {{combo-box filterable=true content=selectableChildThemes value=selectedChildThemeId}} + {{combo-box forceEscape=true filterable=true content=selectableChildThemes value=selectedChildThemeId}} {{#d-button action="addChildTheme" icon="plus"}}{{i18n "admin.customize.theme.add"}}{{/d-button}}

{{/if}} diff --git a/app/assets/javascripts/select-kit/components/list-setting.js.es6 b/app/assets/javascripts/select-kit/components/list-setting.js.es6 index 457cc62bba1..6cf37e05897 100644 --- a/app/assets/javascripts/select-kit/components/list-setting.js.es6 +++ b/app/assets/javascripts/select-kit/components/list-setting.js.es6 @@ -17,12 +17,9 @@ export default MultiSelectComponent.extend({ } if (this.get("nameProperty").indexOf("color") > -1) { - this.set( - "headerComponentOptions", - Ember.Object.create({ - selectedNameComponent: "multi-select/selected-color" - }) - ); + this.get("headerComponentOptions").setProperties({ + selectedNameComponent: "multi-select/selected-color" + }); } }, diff --git a/app/assets/javascripts/select-kit/components/multi-select.js.es6 b/app/assets/javascripts/select-kit/components/multi-select.js.es6 index b2a71ebf88c..79dc0c0f148 100644 --- a/app/assets/javascripts/select-kit/components/multi-select.js.es6 +++ b/app/assets/javascripts/select-kit/components/multi-select.js.es6 @@ -31,12 +31,9 @@ export default SelectKitComponent.extend({ this.set("values", []); } - this.set( - "headerComponentOptions", - Ember.Object.create({ - selectedNameComponent: this.get("selectedNameComponent") - }) - ); + this.get("headerComponentOptions").setProperties({ + selectedNameComponent: this.get("selectedNameComponent") + }); }, @on("didRender") diff --git a/app/assets/javascripts/select-kit/components/multi-select/multi-select-header.js.es6 b/app/assets/javascripts/select-kit/components/multi-select/multi-select-header.js.es6 index b87881ec5ba..9b82221f005 100644 --- a/app/assets/javascripts/select-kit/components/multi-select/multi-select-header.js.es6 +++ b/app/assets/javascripts/select-kit/components/multi-select/multi-select-header.js.es6 @@ -14,6 +14,8 @@ export default SelectKitHeaderComponent.extend({ "select-kit/templates/components/multi-select/multi-select-header", selectedNameComponent: Ember.computed.alias("options.selectedNameComponent"), + forceEscape: Ember.computed.alias("options.forceEscape"), + ariaLabel: Ember.computed.or("computedContent.ariaLabel", "title", "names"), title: Ember.computed.or("computedContent.title", "names"), diff --git a/app/assets/javascripts/select-kit/components/select-kit.js.es6 b/app/assets/javascripts/select-kit/components/select-kit.js.es6 index e490b61ea1b..b69c1d5d049 100644 --- a/app/assets/javascripts/select-kit/components/select-kit.js.es6 +++ b/app/assets/javascripts/select-kit/components/select-kit.js.es6 @@ -81,13 +81,22 @@ export default Ember.Component.extend( minimum: null, minimumLabel: null, maximumLabel: null, + forceEscape: false, init() { this._super(); this.noneValue = "__none__"; - this.set("headerComponentOptions", Ember.Object.create()); - this.set("rowComponentOptions", Ember.Object.create()); + this.set( + "headerComponentOptions", + Ember.Object.create({ forceEscape: this.get("forceEscape") }) + ); + this.set( + "rowComponentOptions", + Ember.Object.create({ + forceEscape: this.get("forceEscape") + }) + ); this.set("computedContent", []); this.set("highlightedSelection", []); diff --git a/app/assets/javascripts/select-kit/components/select-kit/select-kit-header.js.es6 b/app/assets/javascripts/select-kit/components/select-kit/select-kit-header.js.es6 index 79464c9109b..3253c5d9a27 100644 --- a/app/assets/javascripts/select-kit/components/select-kit/select-kit-header.js.es6 +++ b/app/assets/javascripts/select-kit/components/select-kit/select-kit-header.js.es6 @@ -14,6 +14,8 @@ export default Ember.Component.extend({ "name:data-name" ], + forceEscape: Ember.computed.alias("options.forceEscape"), + isNone: Ember.computed.none("computedContent.value"), ariaHasPopup: true, diff --git a/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 b/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 index a289beeccf0..a1c7f6ba4af 100644 --- a/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 +++ b/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 @@ -18,6 +18,8 @@ export default Ember.Component.extend(UtilsMixin, { ], classNameBindings: ["isHighlighted", "isSelected"], + forceEscape: Ember.computed.alias("options.forceEscape"), + ariaLabel: Ember.computed.or("computedContent.ariaLabel", "title"), @computed("computedContent.title", "name") diff --git a/app/assets/javascripts/select-kit/templates/components/combo-box/combo-box-header.hbs b/app/assets/javascripts/select-kit/templates/components/combo-box/combo-box-header.hbs index b13075d3f2d..c9fc965ee83 100644 --- a/app/assets/javascripts/select-kit/templates/components/combo-box/combo-box-header.hbs +++ b/app/assets/javascripts/select-kit/templates/components/combo-box/combo-box-header.hbs @@ -1,7 +1,11 @@ {{#each icons as |icon|}} {{d-icon icon}} {{/each}} - {{{label}}} + {{#if forceEscape}} + {{label}} + {{else}} + {{{label}}} + {{/if}} {{#if shouldDisplayClearableButton}} diff --git a/app/assets/javascripts/select-kit/templates/components/future-date-input-selector/future-date-input-selector-header.hbs b/app/assets/javascripts/select-kit/templates/components/future-date-input-selector/future-date-input-selector-header.hbs index c566d3b1e5d..a5c5cbd6a36 100644 --- a/app/assets/javascripts/select-kit/templates/components/future-date-input-selector/future-date-input-selector-header.hbs +++ b/app/assets/javascripts/select-kit/templates/components/future-date-input-selector/future-date-input-selector-header.hbs @@ -5,7 +5,11 @@ {{/if}} - {{{label}}} + {{#if forceEscape}} + {{label}} + {{else}} + {{{label}}} + {{/if}} {{#if computedContent.datetime}} diff --git a/app/assets/javascripts/select-kit/templates/components/multi-select/multi-select-header.hbs b/app/assets/javascripts/select-kit/templates/components/multi-select/multi-select-header.hbs index 2627302c4e7..e95d429d27f 100644 --- a/app/assets/javascripts/select-kit/templates/components/multi-select/multi-select-header.hbs +++ b/app/assets/javascripts/select-kit/templates/components/multi-select/multi-select-header.hbs @@ -3,6 +3,7 @@ {{component selectedNameComponent onClickSelectionItem=onClickSelectionItem highlightedSelection=highlightedSelection + forceEscape=forceEscape computedContent=selection}} {{/each}} diff --git a/app/assets/javascripts/select-kit/templates/components/multi-select/selected-name.hbs b/app/assets/javascripts/select-kit/templates/components/multi-select/selected-name.hbs index ffa6a8f3b91..141ae2748f6 100644 --- a/app/assets/javascripts/select-kit/templates/components/multi-select/selected-name.hbs +++ b/app/assets/javascripts/select-kit/templates/components/multi-select/selected-name.hbs @@ -2,7 +2,11 @@
- {{{label}}} + {{#if forceEscape}} + {{label}} + {{else}} + {{{label}}} + {{/if}}
diff --git a/app/assets/javascripts/select-kit/templates/components/select-kit/select-kit-header.hbs b/app/assets/javascripts/select-kit/templates/components/select-kit/select-kit-header.hbs index e65ce13500b..77ea5328166 100644 --- a/app/assets/javascripts/select-kit/templates/components/select-kit/select-kit-header.hbs +++ b/app/assets/javascripts/select-kit/templates/components/select-kit/select-kit-header.hbs @@ -1,5 +1,9 @@ {{#each icons as |icon|}} {{d-icon icon}} {{/each}} - {{{label}}} + {{#if forceEscape}} + {{label}} + {{else}} + {{{label}}} + {{/if}} diff --git a/app/assets/javascripts/select-kit/templates/components/select-kit/select-kit-row.hbs b/app/assets/javascripts/select-kit/templates/components/select-kit/select-kit-row.hbs index fc0df658357..984d7091516 100644 --- a/app/assets/javascripts/select-kit/templates/components/select-kit/select-kit-row.hbs +++ b/app/assets/javascripts/select-kit/templates/components/select-kit/select-kit-row.hbs @@ -2,5 +2,11 @@ {{{template}}} {{else}} {{#each icons as |icon|}} {{d-icon icon}} {{/each}} - {{{label}}} + + {{#if forceEscape}} + {{label}} + {{else}} + {{{label}}} + {{/if}} + {{/if}} diff --git a/app/assets/javascripts/select-kit/templates/components/tag-drop/tag-drop-header.hbs b/app/assets/javascripts/select-kit/templates/components/tag-drop/tag-drop-header.hbs index 7e3ea1baf4f..440988e3efe 100644 --- a/app/assets/javascripts/select-kit/templates/components/tag-drop/tag-drop-header.hbs +++ b/app/assets/javascripts/select-kit/templates/components/tag-drop/tag-drop-header.hbs @@ -1,5 +1,9 @@ - {{{label}}} + {{#if forceEscape}} + {{label}} + {{else}} + {{{label}}} + {{/if}} {{d-icon caretIcon class="caret-icon fa-fw"}} diff --git a/test/javascripts/components/multi-select-test.js.es6 b/test/javascripts/components/multi-select-test.js.es6 index b1f78fdfae0..ea13a619082 100644 --- a/test/javascripts/components/multi-select-test.js.es6 +++ b/test/javascripts/components/multi-select-test.js.es6 @@ -247,3 +247,73 @@ componentTest("with minimumLabel", { ); } }); + +componentTest("with forceEscape", { + template: "{{multi-select content=content forceEscape=true}}", + + beforeEach() { + this.set("content", ["
sam
"]); + }, + + async test(assert) { + await this.get("subject").expand(); + + const row = this.get("subject").rowByIndex(0); + assert.equal( + row + .el() + .find(".name") + .html() + .trim(), + "<div>sam</div>" + ); + + await this.get("subject").fillInFilter("
jeff
"); + await this.get("subject").keyboard("enter"); + + assert.equal( + this.get("subject") + .header() + .el() + .find(".name") + .html() + .trim(), + "<div>jeff</div>" + ); + } +}); + +componentTest("with forceEscape", { + template: "{{multi-select content=content forceEscape=false}}", + + beforeEach() { + this.set("content", ["
sam
"]); + }, + + async test(assert) { + await this.get("subject").expand(); + + const row = this.get("subject").rowByIndex(0); + assert.equal( + row + .el() + .find(".name") + .html() + .trim(), + "
sam
" + ); + + await this.get("subject").fillInFilter("
jeff
"); + await this.get("subject").keyboard("enter"); + + assert.equal( + this.get("subject") + .header() + .el() + .find(".name") + .html() + .trim(), + "
jeff
" + ); + } +}); diff --git a/test/javascripts/components/single-select-test.js.es6 b/test/javascripts/components/single-select-test.js.es6 index 7e6c6158a40..439781e202e 100644 --- a/test/javascripts/components/single-select-test.js.es6 +++ b/test/javascripts/components/single-select-test.js.es6 @@ -771,3 +771,67 @@ componentTest("with no content and allowAny", { assert.ok(!$filter.hasClass("is-hidden")); } }); + +componentTest("with forceEscape", { + template: "{{single-select content=content forceEscape=true}}", + + beforeEach() { + this.set("content", ["
sam
"]); + }, + + async test(assert) { + await this.get("subject").expand(); + + const row = this.get("subject").rowByIndex(0); + assert.equal( + row + .el() + .find(".name") + .html() + .trim(), + "<div>sam</div>" + ); + + assert.equal( + this.get("subject") + .header() + .el() + .find(".selected-name") + .html() + .trim(), + "<div>sam</div>" + ); + } +}); + +componentTest("without forceEscape", { + template: "{{single-select content=content forceEscape=false}}", + + beforeEach() { + this.set("content", ["
sam
"]); + }, + + async test(assert) { + await this.get("subject").expand(); + + const row = this.get("subject").rowByIndex(0); + assert.equal( + row + .el() + .find(".name") + .html() + .trim(), + "
sam
" + ); + + assert.equal( + this.get("subject") + .header() + .el() + .find(".selected-name") + .html() + .trim(), + "
sam
" + ); + } +});