mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
DEV: Consolidate i18n import paths (#29804)
Enables our new eslint rules which enforce consistent i18n imports. For more info, see 0d58b40cd7
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import $ from "jquery";
|
||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
function initializeDetails(api) {
|
||||
api.decorateCooked(($elem) => $("details", $elem), {
|
||||
@ -10,7 +10,7 @@ function initializeDetails(api) {
|
||||
api.addComposerToolbarPopupMenuOption({
|
||||
action: function (toolbarEvent) {
|
||||
toolbarEvent.applySurround(
|
||||
"\n" + `[details="${I18n.t("composer.details_title")}"]` + "\n",
|
||||
"\n" + `[details="${i18n("composer.details_title")}"]` + "\n",
|
||||
"\n[/details]\n",
|
||||
"details_text",
|
||||
{ multiline: false }
|
||||
|
@ -2,7 +2,7 @@ import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import I18n from "discourse-i18n";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
|
||||
acceptance("Details Button", function (needs) {
|
||||
needs.user();
|
||||
@ -17,11 +17,11 @@ acceptance("Details Button", function (needs) {
|
||||
await categoryChooser.selectRowByValue(2);
|
||||
|
||||
await popupMenu.expand();
|
||||
await popupMenu.selectRowByName(I18n.t("details.title"));
|
||||
await popupMenu.selectRowByName(i18n("details.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`\n[details="${I18n.t("composer.details_title")}"]\n${I18n.t(
|
||||
`\n[details="${i18n("composer.details_title")}"]\n${i18n(
|
||||
"composer.details_text"
|
||||
)}\n[/details]\n`,
|
||||
"it should contain the right output"
|
||||
@ -34,11 +34,11 @@ acceptance("Details Button", function (needs) {
|
||||
textarea.selectionEnd = textarea.value.length;
|
||||
|
||||
await popupMenu.expand();
|
||||
await popupMenu.selectRowByName(I18n.t("details.title"));
|
||||
await popupMenu.selectRowByName(i18n("details.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`\n[details="${I18n.t(
|
||||
`\n[details="${i18n(
|
||||
"composer.details_title"
|
||||
)}"]\nThis is my title\n[/details]\n`,
|
||||
"it should contain the right selected output"
|
||||
@ -61,11 +61,11 @@ acceptance("Details Button", function (needs) {
|
||||
textarea.selectionEnd = 28;
|
||||
|
||||
await popupMenu.expand();
|
||||
await popupMenu.selectRowByName(I18n.t("details.title"));
|
||||
await popupMenu.selectRowByName(i18n("details.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`Before \n[details="${I18n.t(
|
||||
`Before \n[details="${i18n(
|
||||
"composer.details_title"
|
||||
)}"]\nsome text in between\n[/details]\n After`,
|
||||
"it should contain the right output"
|
||||
@ -88,11 +88,11 @@ acceptance("Details Button", function (needs) {
|
||||
textarea.selectionEnd = 29;
|
||||
|
||||
await popupMenu.expand();
|
||||
await popupMenu.selectRowByName(I18n.t("details.title"));
|
||||
await popupMenu.selectRowByName(i18n("details.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`Before \n\n[details="${I18n.t(
|
||||
`Before \n\n[details="${i18n(
|
||||
"composer.details_title"
|
||||
)}"]\nsome text in between\n[/details]\n\n After`,
|
||||
"it should contain the right output"
|
||||
@ -126,11 +126,11 @@ acceptance("Details Button", function (needs) {
|
||||
textarea.selectionEnd = textarea.value.length;
|
||||
|
||||
await popupMenu.expand();
|
||||
await popupMenu.selectRowByName(I18n.t("details.title"));
|
||||
await popupMenu.selectRowByName(i18n("details.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`\n[details="${I18n.t(
|
||||
`\n[details="${i18n(
|
||||
"composer.details_title"
|
||||
)}"]\n${multilineInput}\n[/details]\n`,
|
||||
"it should contain the right output"
|
||||
|
Reference in New Issue
Block a user