diff --git a/packages/nc-gui/components/cell/MultiSelect.vue b/packages/nc-gui/components/cell/MultiSelect.vue index 7bd77a36ef..9d6ec72434 100644 --- a/packages/nc-gui/components/cell/MultiSelect.vue +++ b/packages/nc-gui/components/cell/MultiSelect.vue @@ -32,6 +32,7 @@ interface Props { modelValue?: string | string[] rowIndex?: number disableOptionCreation?: boolean + location?: 'cell' | 'filter' } const { modelValue, disableOptionCreation } = defineProps() @@ -336,7 +337,7 @@ useEventListener(document, 'click', handleClose, true) v-for="op of options" :key="op.id || op.title" :value="op.title" - :data-testid="`select-option-${column.title}-${rowIndex}`" + :data-testid="`select-option-${column.title}-${location === 'filter' ? 'filter' : rowIndex}`" :class="`nc-select-option-${column.title}-${op.title}`" @click.stop > diff --git a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue index e33248ed31..527b4b60fe 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue @@ -85,17 +85,17 @@ const filterUpdateCondition = (filter: FilterType, i: number) => { ) { // anyof and nanyof can allow multiple selections, // while `eq` and `neq` only allow one selection - filter.value = '' + filter.value = null } else if (['blank', 'notblank', 'empty', 'notempty', 'null', 'notnull'].includes(filter.comparison_op!)) { // since `blank`, `empty`, `null` doesn't require value, // hence remove the previous value - filter.value = '' + filter.value = null filter.comparison_sub_op = '' } else if ([UITypes.Date, UITypes.DateTime].includes(col.uidt as UITypes)) { // for date / datetime, // the input type could be decimal or datepicker / datetime picker // hence remove the previous value - filter.value = '' + filter.value = null if ( !comparisonSubOpList(filter.comparison_op!) .map((op) => op.value) @@ -181,7 +181,7 @@ const selectFilterField = (filter: Filter, index: number) => { } // reset filter value as well - filter.value = '' + filter.value = null saveOrUpdate(filter, index) } diff --git a/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue b/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue index 6a2072cba4..f664861195 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue @@ -193,6 +193,7 @@ const hasExtraPadding = $computed(() => { :column="column" class="flex" v-bind="componentProps" + location="filter" /> diff --git a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts index 10d7892b76..44e3457638 100644 --- a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts +++ b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts @@ -123,7 +123,7 @@ export class ToolbarFilterPage extends BasePage { for (let i = 0; i < v.length; i++) { await this.rootPage .locator(`.nc-dropdown-multi-select-cell`) - .locator(`.nc-select-option-MultiSelect-${v[i]}`) + .locator(`[data-testid="select-option-MultiSelect-filter"].nc-select-option-MultiSelect-${v[i]}`) .click(); } break;