DEV: Rename `translatedtitle` to `translatedTitle` (#17160)

This commit is contained in:
Jarek Radosz 2022-06-20 20:28:05 +02:00 committed by GitHub
parent 36c2284dea
commit 011a16cb8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 5 deletions

View File

@ -3,6 +3,7 @@ import attributeHook from "discourse-common/lib/attribute-hook";
import { h } from "virtual-dom";
import { isDevelopment } from "discourse-common/config/environment";
import escape from "discourse-common/lib/escape";
import deprecated from "discourse-common/lib/deprecated";
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
let _renderers = [];
@ -159,9 +160,18 @@ registerIconRenderer({
I18n.t(params.title)
)}'>${html}</span>`;
}
if (params.translatedtitle) {
deprecated(`use 'translatedTitle' option instead of 'translatedtitle'`, {
since: "2.9.0.beta6",
dropFrom: "2.10.0.beta1",
});
params.translatedTitle = params.translatedtitle;
}
if (params.translatedTitle) {
html = `<span class="svg-icon-title" title='${escape(
params.translatedtitle
params.translatedTitle
)}'>${html}</span>`;
}
return html;

View File

@ -1 +1 @@
{{d-icon icon translatedtitle=title class=cssClasses}}
{{d-icon icon translatedTitle=title class=cssClasses}}

View File

@ -27,7 +27,7 @@ module("Unit | Utility | icon-library", function () {
test("escape icon names, classes and titles", function (assert) {
const html = iconHTML("'<img src='x'>", {
translatedtitle: "'<script src='y'>",
translatedTitle: "'<script src='y'>",
label: "<iframe src='z'>",
class: "'<link href='w'>",
});

View File

@ -2,7 +2,7 @@
<div class="icons">
<span class="selection-indicator"></span>
{{#each icons as |icon|}}
{{d-icon icon translatedtitle=(dasherize title)}}
{{d-icon icon translatedTitle=(dasherize title)}}
{{/each}}
</div>
{{/if}}

View File

@ -1,5 +1,5 @@
{{#each icons as |icon|}}
{{d-icon icon translatedtitle=dasherizedTitle}}
{{d-icon icon translatedTitle=dasherizedTitle}}
{{/each}}
<span class="name">