@@ -11,6 +11,7 @@ import {
1111 typeTextIntoCell ,
1212 getPrimaryFieldId ,
1313 addFilterByFieldName ,
14+ clickFilterChip ,
1415 deleteFilter ,
1516 assertRowCount ,
1617} from '../../support/filter-test-helpers' ;
@@ -236,4 +237,120 @@ describe('Database Checkbox Filter Tests (Desktop Parity)', () => {
236237 } ) ;
237238 } ) ;
238239 } ) ;
240+
241+ it ( 'checkbox filter - delete filter restores all rows' , ( ) => {
242+ const email = generateRandomEmail ( ) ;
243+ loginAndCreateGrid ( email ) . then ( ( ) => {
244+ getPrimaryFieldId ( ) . then ( ( primaryFieldId ) => {
245+ // Add a Checkbox field
246+ addFieldWithType ( FieldType . Checkbox ) ;
247+ waitForReactUpdate ( 1000 ) ;
248+
249+ // Get the checkbox field ID
250+ cy . get ( '[data-testid^="grid-field-header-"]' )
251+ . last ( )
252+ . invoke ( 'attr' , 'data-testid' )
253+ . then ( ( testId ) => {
254+ const checkboxFieldId = testId ?. replace ( 'grid-field-header-' , '' ) || '' ;
255+
256+ // Enter names
257+ typeTextIntoCell ( primaryFieldId , 0 , 'Task One' ) ;
258+ typeTextIntoCell ( primaryFieldId , 1 , 'Task Two' ) ;
259+ typeTextIntoCell ( primaryFieldId , 2 , 'Task Three' ) ;
260+ waitForReactUpdate ( 500 ) ;
261+
262+ // Check first and third rows
263+ toggleCheckbox ( checkboxFieldId , 0 ) ;
264+ toggleCheckbox ( checkboxFieldId , 2 ) ;
265+ waitForReactUpdate ( 500 ) ;
266+
267+ // Verify initial row count
268+ assertRowCount ( 3 ) ;
269+
270+ // Add filter for "Is Checked"
271+ addFilterByFieldName ( 'Checkbox' ) ;
272+ waitForReactUpdate ( 500 ) ;
273+ changeCheckboxFilterCondition ( CheckboxFilterCondition . IsChecked ) ;
274+ waitForReactUpdate ( 500 ) ;
275+ cy . get ( 'body' ) . type ( '{esc}' ) ;
276+ waitForReactUpdate ( 500 ) ;
277+
278+ // Should show 2 checked rows
279+ assertRowCount ( 2 ) ;
280+
281+ // Delete the filter
282+ clickFilterChip ( ) ;
283+ waitForReactUpdate ( 300 ) ;
284+ deleteFilter ( ) ;
285+ waitForReactUpdate ( 500 ) ;
286+
287+ // All rows should be visible again
288+ assertRowCount ( 3 ) ;
289+ } ) ;
290+ } ) ;
291+ } ) ;
292+ } ) ;
293+
294+ it ( 'checkbox filter - change condition dynamically' , ( ) => {
295+ const email = generateRandomEmail ( ) ;
296+ loginAndCreateGrid ( email ) . then ( ( ) => {
297+ getPrimaryFieldId ( ) . then ( ( primaryFieldId ) => {
298+ // Add a Checkbox field
299+ addFieldWithType ( FieldType . Checkbox ) ;
300+ waitForReactUpdate ( 1000 ) ;
301+
302+ // Get the checkbox field ID
303+ cy . get ( '[data-testid^="grid-field-header-"]' )
304+ . last ( )
305+ . invoke ( 'attr' , 'data-testid' )
306+ . then ( ( testId ) => {
307+ const checkboxFieldId = testId ?. replace ( 'grid-field-header-' , '' ) || '' ;
308+
309+ // Enter names
310+ typeTextIntoCell ( primaryFieldId , 0 , 'Checked Task' ) ;
311+ typeTextIntoCell ( primaryFieldId , 1 , 'Unchecked Task' ) ;
312+ typeTextIntoCell ( primaryFieldId , 2 , 'Also Checked' ) ;
313+ waitForReactUpdate ( 500 ) ;
314+
315+ // Check first and third rows
316+ toggleCheckbox ( checkboxFieldId , 0 ) ;
317+ toggleCheckbox ( checkboxFieldId , 2 ) ;
318+ waitForReactUpdate ( 500 ) ;
319+
320+ // Verify initial row count
321+ assertRowCount ( 3 ) ;
322+
323+ // Add filter for "Is Checked"
324+ addFilterByFieldName ( 'Checkbox' ) ;
325+ waitForReactUpdate ( 500 ) ;
326+ changeCheckboxFilterCondition ( CheckboxFilterCondition . IsChecked ) ;
327+ waitForReactUpdate ( 500 ) ;
328+ cy . get ( 'body' ) . type ( '{esc}' ) ;
329+ waitForReactUpdate ( 500 ) ;
330+
331+ // Should show 2 checked rows
332+ assertRowCount ( 2 ) ;
333+ DatabaseGridSelectors . dataRowCellsForField ( primaryFieldId )
334+ . should ( 'contain.text' , 'Checked Task' )
335+ . and ( 'contain.text' , 'Also Checked' ) ;
336+
337+ // Change to "Is Unchecked"
338+ clickFilterChip ( ) ;
339+ waitForReactUpdate ( 300 ) ;
340+ changeCheckboxFilterCondition ( CheckboxFilterCondition . IsUnchecked ) ;
341+ waitForReactUpdate ( 500 ) ;
342+ cy . get ( 'body' ) . type ( '{esc}' ) ;
343+ waitForReactUpdate ( 500 ) ;
344+
345+ // Should show 1 unchecked row
346+ assertRowCount ( 1 ) ;
347+ DatabaseGridSelectors . dataRowCellsForField ( primaryFieldId )
348+ . should ( 'contain.text' , 'Unchecked Task' ) ;
349+ DatabaseGridSelectors . dataRowCellsForField ( primaryFieldId )
350+ . should ( 'not.contain.text' , 'Checked Task' )
351+ . and ( 'not.contain.text' , 'Also Checked' ) ;
352+ } ) ;
353+ } ) ;
354+ } ) ;
355+ } ) ;
239356} ) ;
0 commit comments