feat(zookeeper): add UTF-8 value preview

Closes #6897
This commit is contained in:
t8y2 committed 2026-08-22 07:21:26 +00:00
1 parent b2cf487734
commit fe269a28db
14 files changed
+209 -6

No files matched your search

@@ -0,0 +1,26 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
const browserSource = readFileSync(new URL("../KvKeyBrowser.vue", import.meta.url), "utf8");
describe("KvKeyBrowser Base64 UTF-8 preview", () => {
it("keeps the preview opt-in for backend-specific wrappers", () => {
expect(browserSource).toContain("enableBase64Utf8Preview?: boolean");
expect(browserSource).toContain("enableBase64Utf8Preview: false");
});
it("copies the selected derived view while preserving the raw value path", () => {
expect(browserSource).toContain("selectedValueClipboardText");
expect(browserSource).toContain("copyToClipboard(selectedValueClipboardText.value)");
expect(browserSource.match(/selectedBase64ViewMode\.value = "utf8"/g)).toHaveLength(2);
expect(browserSource).toContain("editValue.value = selectedTextValue.value");
expect(browserSource).toContain("value: selectedValue.value.value");
});
it("offers explicit UTF-8 and Base64 view controls with error feedback", () => {
expect(browserSource).toContain('data-testid="kv-base64-utf8-view"');
expect(browserSource).toContain('data-testid="kv-base64-raw-view"');
expect(browserSource).toContain("labels.utf8PreviewLossy");
expect(browserSource).toContain("labels.utf8PreviewUnavailable");
});
});