From 8e08b8b218f0c929ddafc31feef55028b77b26b9 Mon Sep 17 00:00:00 2001 From: Elias Meire Date: Fri, 1 Mar 2024 13:09:03 +0100 Subject: [PATCH 1/2] Filter component: expressions by default --- .../src/components/FilterConditions/FilterConditions.vue | 2 +- .../FilterConditions/__tests__/FilterConditions.test.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/editor-ui/src/components/FilterConditions/FilterConditions.vue b/packages/editor-ui/src/components/FilterConditions/FilterConditions.vue index c81c0f0297a5f..067c1ffbd568f 100644 --- a/packages/editor-ui/src/components/FilterConditions/FilterConditions.vue +++ b/packages/editor-ui/src/components/FilterConditions/FilterConditions.vue @@ -43,7 +43,7 @@ const ndvStore = useNDVStore(); const { debounce } = useDebounce(); function createCondition(): FilterConditionValue { - return { id: uuid(), leftValue: '', rightValue: '', operator: DEFAULT_OPERATOR_VALUE }; + return { id: uuid(), leftValue: '=', rightValue: '=', operator: DEFAULT_OPERATOR_VALUE }; } const allowedCombinators = computed( diff --git a/packages/editor-ui/src/components/FilterConditions/__tests__/FilterConditions.test.ts b/packages/editor-ui/src/components/FilterConditions/__tests__/FilterConditions.test.ts index dd687f0156559..903fd2b2a07a9 100644 --- a/packages/editor-ui/src/components/FilterConditions/__tests__/FilterConditions.test.ts +++ b/packages/editor-ui/src/components/FilterConditions/__tests__/FilterConditions.test.ts @@ -42,7 +42,14 @@ describe('FilterConditions.vue', () => { expect(getByTestId('filter-conditions')).toBeInTheDocument(); expect(await findAllByTestId('filter-condition')).toHaveLength(1); expect(getByTestId('filter-condition-left')).toBeInTheDocument(); + expect( + within(getByTestId('filter-condition-left')).getByTestId('inline-expression-editor-input'), + ).toBeInTheDocument(); expect(getByTestId('filter-operator-select')).toBeInTheDocument(); + expect(getByTestId('filter-condition-right')).toBeInTheDocument(); + expect( + within(getByTestId('filter-condition-right')).getByTestId('inline-expression-editor-input'), + ).toBeInTheDocument(); // Only visible when multiple conditions expect(queryByTestId('filter-combinator-select')).not.toBeInTheDocument(); From a7d18c57a3310d246f196357a3a9431f4c56a16c Mon Sep 17 00:00:00 2001 From: Elias Meire Date: Wed, 6 Mar 2024 20:54:06 +0100 Subject: [PATCH 2/2] Update e2e test for if node to use expression inputs --- cypress/e2e/30-if-node.cy.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/30-if-node.cy.ts b/cypress/e2e/30-if-node.cy.ts index 95ed1e9a0d34d..5f3aca7b8421e 100644 --- a/cypress/e2e/30-if-node.cy.ts +++ b/cypress/e2e/30-if-node.cy.ts @@ -24,8 +24,16 @@ describe('If Node (filter component)', () => { // Add ndv.actions.addFilterCondition(FILTER_PARAM_NAME); - ndv.getters.filterConditionLeft(FILTER_PARAM_NAME, 0).find('input').type('first left'); - ndv.getters.filterConditionLeft(FILTER_PARAM_NAME, 1).find('input').type('second left'); + ndv.getters + .filterConditionLeft(FILTER_PARAM_NAME, 0) + .find('.cm-content') + .first() + .type('first left'); + ndv.getters + .filterConditionLeft(FILTER_PARAM_NAME, 1) + .find('.cm-content') + .first() + .type('second left'); ndv.actions.addFilterCondition(FILTER_PARAM_NAME); ndv.getters.filterConditions(FILTER_PARAM_NAME).should('have.length', 3); @@ -34,8 +42,9 @@ describe('If Node (filter component)', () => { ndv.getters.filterConditions(FILTER_PARAM_NAME).should('have.length', 2); ndv.getters .filterConditionLeft(FILTER_PARAM_NAME, 0) - .find('input') - .should('have.value', 'second left'); + .find('.cm-content') + .first() + .should('have.text', 'second left'); ndv.actions.removeFilterCondition(FILTER_PARAM_NAME, 1); ndv.getters.filterConditions(FILTER_PARAM_NAME).should('have.length', 1); });