feat(editor): apply word wrap to config editors

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-08-13 01:59:04 +08:00
1 parent f88e39563d
commit 1d2a47fee0
13 files changed
+48 -12

No files matched your search

@@ -2,6 +2,7 @@ import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
const browserSource = readFileSync(new URL("../KvKeyBrowser.vue", import.meta.url), "utf8");
const valueEditorSource = readFileSync(new URL("../KvValueEditor.vue", import.meta.url), "utf8");
describe("KvKeyBrowser edit dialog layout", () => {
it("keeps the value format label and selector together in the editor toolbar", () => {
@@ -28,4 +29,16 @@ describe("KvKeyBrowser edit dialog layout", () => {
expect(browserSource).toContain('<Copy v-else class="h-4 w-4" />');
expect(browserSource).toMatch(/<pre\s+data-native-clipboard/);
});
it("keeps the selected value preview word wrapping aligned with the global editor setting", () => {
expect(browserSource).toContain(":class=\"settingsStore.editorSettings.wordWrap ? 'whitespace-pre-wrap break-words' : 'whitespace-pre'\"");
expect(browserSource).not.toContain("bg-muted/20 whitespace-pre-wrap break-words p-3");
});
it("keeps shared KV value editor word wrapping aligned with the global editor setting", () => {
expect(valueEditorSource).toContain("const wordWrapCompartment = new Compartment()");
expect(valueEditorSource).toContain("wordWrapCompartment.of(wordWrapExtension())");
expect(valueEditorSource).toContain("wordWrapCompartment.reconfigure(wordWrapExtension(wordWrap))");
expect(valueEditorSource).not.toContain("\n EditorView.lineWrapping,\n");
});
});