fix(grid): improve filter condition expansion
This commit is contained in:
7 files changed
+180
-24
No files matched your search
@@ -1,6 +1,8 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { createApp, defineComponent, h, nextTick, ref, type App } from "vue";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import DataGridConditionEditor from "@/components/grid/DataGridConditionEditor.vue";
|
||||
import type { DataGridConditionHistoryKind } from "@/lib/dataGrid/dataGridConditionHistory";
|
||||
@@ -99,4 +101,44 @@ describe("DataGridConditionEditor quote completion", () => {
|
||||
expect(input.selectionStart).toBe(20);
|
||||
expect(input.selectionEnd).toBe(20);
|
||||
});
|
||||
|
||||
it("keeps expanded input first-line indent without forced word breaks", () => {
|
||||
const source = readFileSync(resolve(process.cwd(), "apps/desktop/src/components/grid/DataGridConditionEditor.vue"), "utf8");
|
||||
const expandedInputCss = source.match(/\.data-grid-topbar-condition-input--expanded\s*\{(?<body>[\s\S]*?)\n\}/)?.groups?.body;
|
||||
|
||||
expect(expandedInputCss).toContain("padding:");
|
||||
expect(expandedInputCss).toContain("text-indent: var(--data-grid-condition-prefix-indent)");
|
||||
expect(expandedInputCss).toContain("overflow-wrap: normal");
|
||||
expect(source).toContain("white-space:pre-wrap;overflow-wrap:normal;");
|
||||
});
|
||||
|
||||
it("keeps the expanded condition label readable over wrapped content", () => {
|
||||
const source = readFileSync(resolve(process.cwd(), "apps/desktop/src/components/grid/DataGridConditionEditor.vue"), "utf8");
|
||||
const floatingControls = source.match(/data-grid-topbar-condition-floating-controls[^"]*/)?.[0];
|
||||
const floatingLabelCss = source.match(/\.data-grid-topbar-condition-label--floating\s*\{(?<body>[\s\S]*?)\n\}/)?.groups?.body;
|
||||
|
||||
expect(floatingControls).toContain("z-[2]");
|
||||
expect(source).toContain("data-grid-topbar-condition-label--floating");
|
||||
expect(floatingLabelCss).toContain("text-shadow:");
|
||||
expect(floatingLabelCss).not.toContain("padding-right:");
|
||||
expect(floatingLabelCss).not.toContain("box-shadow:");
|
||||
});
|
||||
|
||||
it("scrolls the caret into view after accepting a long completion", () => {
|
||||
const source = readFileSync(resolve(process.cwd(), "apps/desktop/src/components/grid/DataGridConditionEditor.vue"), "utf8");
|
||||
|
||||
expect(source).toContain("function scrollCaretIntoView()");
|
||||
expect(source).toContain("function focusAfterAccept()");
|
||||
expect(source).toContain("void nextTick(scrollCaretIntoView)");
|
||||
expect(source).toContain('if (action === "accept") focusAfterAccept()');
|
||||
});
|
||||
|
||||
it("positions suggestions below the measured expanded editor height", () => {
|
||||
const source = readFileSync(resolve(process.cwd(), "apps/desktop/src/components/grid/DataGridConditionEditor.vue"), "utf8");
|
||||
const expandedPaneCss = source.match(/\.data-grid-topbar-condition-pane--expanded\s*\{(?<body>[\s\S]*?)\n\}/)?.groups?.body;
|
||||
|
||||
expect(source).toContain("bottom: expandedRect.value.top + expandedHeight.value");
|
||||
expect(expandedPaneCss).toContain("transition: box-shadow 150ms ease");
|
||||
expect(expandedPaneCss).not.toContain("height 150ms");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user