diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue index e8652e4e56..cecde644b1 100644 --- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue +++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue @@ -5991,7 +5991,7 @@ onUnmounted(() => {
{{ t("grid.filterSqlPreview") }} WHERE status = 'ACTIVE' - {{ t("grid.applyFilter") }} + {{ t("grid.applyFilter") }}
@@ -6009,7 +6009,7 @@ onUnmounted(() => {
{{ t("grid.filterSqlPreview") }} WHERE status = 'ACTIVE' - {{ t("grid.applyFilter") }} + {{ t("grid.applyFilter") }}
diff --git a/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.previewPosition.spec.ts b/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.previewPosition.spec.ts index 8c8db2db0b..d956da28b1 100644 --- a/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.previewPosition.spec.ts +++ b/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.previewPosition.spec.ts @@ -169,6 +169,8 @@ describe("EditorSettingsDialog live preview placement", () => { expect(dataSection).toContain("data-data-grid-filter-preview-quick"); expect(dataSection).toContain("data-data-grid-filter-preview-conditions"); expect(dataSection).toContain("data-data-grid-filter-preview-text"); + expect(dataSection.match(/text-muted-foreground\/70">\{\{ t\("grid.applyFilter"\) \}\}/g)).toHaveLength(2); + expect(dataSection).not.toContain('rounded bg-primary px-2 py-1 text-primary-foreground">{{ t("grid.applyFilter") }}'); expect(dataSection.match(/editDataGridFilterEditorView = '(quick|conditions|text)'/g)).toHaveLength(3); expect(dataSection).not.toContain(' !rule.columnName); pendingFirstEmptyRuleColumnSearch.value = shouldFocusColumnSearch; emit("ensureRule"); @@ -158,6 +165,7 @@ onUnmounted(onResizeEnd); class="relative flex h-5 w-5 -translate-x-1 shrink-0 items-center justify-center rounded border text-[11px] font-medium transition-colors" :class="filterButtonActive ? 'border-primary/40 bg-primary/10 text-primary hover:bg-primary/15' : 'border-border/70 text-muted-foreground hover:bg-accent hover:text-foreground'" :disabled="!canUseWhereSearch" + :aria-label="t('grid.filter')" @click="handleFilterButtonClick" > @@ -212,6 +220,19 @@ onUnmounted(onResizeEnd); + { expect(applyFilters).toHaveBeenCalledOnce(); }); - it("keeps view selection out of the data grid controls", async () => { + it("keeps the filter toggle available when switching filter views", async () => { + const updateFilterBuilderOpen = vi.fn(); + const ensureRule = vi.fn(); const mounted = mountComponent(DataGridQueryControls, { whereInput: "", orderByInput: "", @@ -1168,16 +1170,26 @@ describe("DataGridQueryControls", () => { applyWhere: vi.fn(), applyOrderBy: vi.fn(), clearOrderBy: vi.fn(), + "onUpdate:filterBuilderOpen": updateFilterBuilderOpen, + onEnsureRule: ensureRule, }); expect(hostText(mounted.root)).not.toContain("grid.filterQuickView"); expect(hostText(mounted.root)).not.toContain("grid.filterConditionView"); - expect(findAll(mounted.root, (node) => node.type === "button" && String(node.props.class).includes("-translate-x-1"))).toHaveLength(1); + const quickFilterButtons = findAll(mounted.root, (node) => node.type === "button" && String(node.props.class).includes("-translate-x-1")); + expect(quickFilterButtons).toHaveLength(1); + expect(quickFilterButtons[0].props["aria-label"]).toBe("grid.filter"); await mounted.setProps({ filterEditorView: "conditions", filterBuilderOpen: false }); await nextTick(); expect(findOne(mounted.root, (node) => node.type === "textarea" && node.props.placeholder === "WHERE")).toBeTruthy(); - expect(findAll(mounted.root, (node) => node.type === "button" && String(node.props.class).includes("-translate-x-1"))).toHaveLength(0); + const filterButtons = findAll(mounted.root, (node) => node.type === "button" && String(node.props.class).includes("-translate-x-1")); + expect(filterButtons).toHaveLength(1); + expect(filterButtons[0].props["aria-label"]).toBe("grid.filter"); + expect(filterButtons[0].props["aria-expanded"]).toBe(false); + dispatch(filterButtons[0], "click"); + expect(updateFilterBuilderOpen).toHaveBeenCalledWith(true); + expect(ensureRule).toHaveBeenCalledOnce(); }); });