diff --git a/packages/main/src/components/FilterBar/FilterBar.cy.tsx b/packages/main/src/components/FilterBar/FilterBar.cy.tsx
index d5a85fb6aa6..def4c7b2b87 100644
--- a/packages/main/src/components/FilterBar/FilterBar.cy.tsx
+++ b/packages/main/src/components/FilterBar/FilterBar.cy.tsx
@@ -298,6 +298,65 @@ describe('FilterBar.cy.tsx', () => {
});
});
+ it('select-all without required', () => {
+ const TestComp = (props) => {
+ const [selectedFilters, setSelectedFilters] = useState('');
+ const [savedVisibleFilters, setSavedVisibleFilters] = useState('');
+
+ const handleSelectionChange: FilterBarPropTypes['onFiltersDialogSelectionChange'] = (e) => {
+ setSelectedFilters(Array.from(e.selectedFilterKeys).join(' '));
+ };
+ const handleSave: FilterBarPropTypes['onFiltersDialogSave'] = (e) => {
+ setSavedVisibleFilters(e.detail.selectedFilterKeys.join(' '));
+ };
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+ Selected:
+ {selectedFilters}
+
+ Saved:
+ {savedVisibleFilters}
+ >
+ );
+ };
+
+ cy.mount();
+
+ cy.findByTestId('selected', '0 1 2');
+ cy.get('[text="Filters"]').click({ force: true });
+ cy.get('[ui5-checkbox]').first().click();
+ cy.findByTestId('selected', '');
+ cy.get('[ui5-checkbox]').eq(1).click();
+ cy.findByTestId('selected', '0');
+ cy.get('[ui5-checkbox]').first().click();
+ cy.get('[ui5-checkbox]').first().click();
+
+ cy.findByText('OK').click();
+ cy.findByTestId('saved', '');
+
+ cy.get('[text="Filters"]').click({ force: true });
+ cy.get('[ui5-checkbox]').first().click();
+ cy.findByText('OK').click();
+ cy.findByTestId('saved', '0 1 2');
+ });
+
// todo selection, group + list view
it('Dialog search', () => {
cy.mount(
diff --git a/packages/main/src/components/FilterBar/FilterDialog.tsx b/packages/main/src/components/FilterBar/FilterDialog.tsx
index 17bcde54415..e6ea7ff0b58 100644
--- a/packages/main/src/components/FilterBar/FilterDialog.tsx
+++ b/packages/main/src/components/FilterBar/FilterDialog.tsx
@@ -373,7 +373,7 @@ export const FilterDialog = (props: FilterDialogPropTypes) => {
};
useEffect(() => {
- if (selectedFilters?.length) {
+ if (selectedFilters) {
selectionChangePayloadRef.current = { selectedFilterKeys: selectedFilters };
}
}, [selectedFilters]);