fix(mqtt): resolve console labels at render time
This commit is contained in:
1 parent
801a96a003
commit
8d084cc655
9 files changed
+296
-3
No files matched your search
@@ -369,7 +369,7 @@ onUnmounted(stopPolling);
|
||||
</label>
|
||||
<label class="flex items-center gap-2 text-xs font-medium">
|
||||
<input v-model="formNoLocal" type="checkbox" :disabled="savingSubscription || !mqtt5" />
|
||||
<span>{{ t("connection.mqttNoLocal") }}(No Local)</span>
|
||||
<span>{{ t("connection.mqttNoLocal") }}</span>
|
||||
<span v-if="!mqtt5" class="font-normal text-muted-foreground">{{ t("connection.mqttNoLocalMqtt5Only") }}</span>
|
||||
</label>
|
||||
<label class="flex items-start gap-2 text-xs font-medium">
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const source = readFileSync(new URL("../MqttAdminConsole.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("MqttAdminConsole i18n regression guards", () => {
|
||||
it("does not append a hardcoded (No Local) suffix to the No Local label", () => {
|
||||
// Issue #5858 follow-up: the subscription dialog used to render
|
||||
// `t("connection.mqttNoLocal")(No Local)`. The CJK-bracket suffix was
|
||||
// locale-invariant and leaked Chinese punctuation into every language.
|
||||
expect(source).not.toContain(")No Local)");
|
||||
expect(source).not.toContain("(No Local)");
|
||||
});
|
||||
|
||||
it("renders the No Local label purely through vue-i18n", () => {
|
||||
// The en locale value for connection.mqttNoLocal is already "No Local", so
|
||||
// dropping the hardcoded suffix loses no information. Guard the intent.
|
||||
expect(source).toContain('t("connection.mqttNoLocal")');
|
||||
expect(source).not.toContain('t("connection.mqttNoLocal")(No Local)');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user