mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-11-13 17:08:20 +00:00
chore: update lint rules
This commit is contained in:
+3
-53
@@ -724,9 +724,6 @@ export const ru: Dict = {
|
||||
toColor: "Цвет конца",
|
||||
direction: "Направление",
|
||||
},
|
||||
options: {
|
||||
direction: { horizontal: "По горизонтали", vertical: "По вертикали" },
|
||||
},
|
||||
},
|
||||
"color-wheel-png": {
|
||||
title: "Цветовой круг PNG",
|
||||
@@ -1051,13 +1048,6 @@ export const ru: Dict = {
|
||||
backgroundColor: "Цвет фона",
|
||||
padding: "Отступ, px",
|
||||
},
|
||||
options: {
|
||||
font: {
|
||||
sans: "Без засечек",
|
||||
serif: "С засечками",
|
||||
mono: "Моноширинный",
|
||||
},
|
||||
},
|
||||
},
|
||||
"emoji-to-png": {
|
||||
title: "Эмодзи в PNG",
|
||||
@@ -1135,8 +1125,11 @@ export const ru: Dict = {
|
||||
"8": "8",
|
||||
"16": "16",
|
||||
"32": "32",
|
||||
"44": "44 (сильный)",
|
||||
"64": "64",
|
||||
"96": "96 (сбалансированный)",
|
||||
"128": "128",
|
||||
"192": "192 (лёгкий)",
|
||||
"256": "256",
|
||||
},
|
||||
},
|
||||
@@ -1269,13 +1262,6 @@ export const ru: Dict = {
|
||||
font: "Шрифт",
|
||||
bold: "Жирный",
|
||||
},
|
||||
options: {
|
||||
font: {
|
||||
sans: "Без засечек",
|
||||
serif: "С засечками",
|
||||
mono: "Моноширинный",
|
||||
},
|
||||
},
|
||||
},
|
||||
"add-text-png": {
|
||||
title: "Надпись на PNG",
|
||||
@@ -1293,24 +1279,6 @@ export const ru: Dict = {
|
||||
plateColor: "Цвет подложки",
|
||||
plateOpacity: "Прозрачность плашки, %",
|
||||
},
|
||||
options: {
|
||||
font: {
|
||||
sans: "Без засечек",
|
||||
serif: "С засечками",
|
||||
mono: "Моноширинный",
|
||||
},
|
||||
position: {
|
||||
"top-left": "Сверху слева",
|
||||
"top-center": "Сверху по центру",
|
||||
"top-right": "Сверху справа",
|
||||
"middle-left": "По центру слева",
|
||||
center: "По центру",
|
||||
"middle-right": "По центру справа",
|
||||
"bottom-left": "Снизу слева",
|
||||
"bottom-center": "Снизу по центру",
|
||||
"bottom-right": "Снизу справа",
|
||||
},
|
||||
},
|
||||
},
|
||||
"date-stamp-png": {
|
||||
title: "Дата-штамп PNG",
|
||||
@@ -1328,24 +1296,6 @@ export const ru: Dict = {
|
||||
plateColor: "Цвет подложки",
|
||||
plateOpacity: "Прозрачность плашки, %",
|
||||
},
|
||||
options: {
|
||||
font: {
|
||||
sans: "Без засечек",
|
||||
serif: "С засечками",
|
||||
mono: "Моноширинный",
|
||||
},
|
||||
position: {
|
||||
"top-left": "Сверху слева",
|
||||
"top-center": "Сверху по центру",
|
||||
"top-right": "Сверху справа",
|
||||
"middle-left": "По центру слева",
|
||||
center: "По центру",
|
||||
"middle-right": "По центру справа",
|
||||
"bottom-left": "Снизу слева",
|
||||
"bottom-center": "Снизу по центру",
|
||||
"bottom-right": "Снизу справа",
|
||||
},
|
||||
},
|
||||
},
|
||||
"skew-png": {
|
||||
title: "Наклонить PNG",
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { TOOLS } from "../registry";
|
||||
import { setLocale } from "./locale.svelte";
|
||||
import { searchTools, verdictText } from "./schema-tool-strings";
|
||||
import {
|
||||
searchTools,
|
||||
toolDescription,
|
||||
toolTitle,
|
||||
verdictText,
|
||||
} from "./schema-tool-strings";
|
||||
|
||||
afterEach(() => {
|
||||
setLocale("ru");
|
||||
@@ -45,6 +50,18 @@ describe("searchTools (кросс-языковой поиск каталога)"
|
||||
});
|
||||
});
|
||||
|
||||
describe("metadata fallback", () => {
|
||||
it("uses registry title and description in the base locale", () => {
|
||||
setLocale("en");
|
||||
for (const tool of TOOLS) {
|
||||
expect(toolTitle(tool), `${tool.id}: title`).toBe(tool.title);
|
||||
expect(toolDescription(tool), `${tool.id}: description`).toBe(
|
||||
tool.description,
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("verdictText (вердикт с vars)", () => {
|
||||
it("интерполирует {vars} в обоих локалях", () => {
|
||||
setLocale("ru");
|
||||
|
||||
@@ -15,6 +15,22 @@ function toolKeys(tool: ToolEntry): { fields: string[]; groups: string[] } {
|
||||
return { fields, groups };
|
||||
}
|
||||
|
||||
type SelectOption = { value: string; label: string };
|
||||
|
||||
function selectOptions(
|
||||
tool: ToolEntry,
|
||||
): { fieldId: string; option: SelectOption }[] {
|
||||
const result: { fieldId: string; option: SelectOption }[] = [];
|
||||
for (const [fieldId, field] of Object.entries(tool.schema?.fields ?? {})) {
|
||||
const spec = (
|
||||
field as { spec?: { kind?: string; options?: SelectOption[] } }
|
||||
).spec;
|
||||
if (spec?.kind !== "select") continue;
|
||||
for (const option of spec.options ?? []) result.push({ fieldId, option });
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
describe("полнота словарей для нового registry", () => {
|
||||
it("у каждого инструмента есть перевод ru с непустыми title/description", () => {
|
||||
for (const tool of TOOLS) {
|
||||
@@ -43,6 +59,22 @@ describe("полнота словарей для нового registry", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("все active select options переведены в en и ru", () => {
|
||||
for (const tool of TOOLS) {
|
||||
for (const { fieldId, option } of selectOptions(tool)) {
|
||||
if (fieldId === "component") continue;
|
||||
const key = `${tool.id}: ${fieldId}.${option.value}`;
|
||||
expect(en.tools[tool.id]?.options?.[fieldId]?.[option.value], key).toBe(
|
||||
option.label,
|
||||
);
|
||||
expect(
|
||||
ru.tools[tool.id]?.options?.[fieldId]?.[option.value],
|
||||
key,
|
||||
).toBeTruthy();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("в словарях нет лишних инструментов", () => {
|
||||
const ids = new Set(TOOLS.map((tool) => tool.id));
|
||||
for (const dict of [ru.tools, en.tools]) {
|
||||
|
||||
Reference in New Issue
Block a user