@@ -178,6 +178,30 @@ describe('when keyExpr is missing', () => {
178178 } ) ;
179179} ) ;
180180
181+ describe ( 'clear selection toolbar button' , ( ) => {
182+ it ( 'should clear selection after runtime selectedCardKeys option update' , ( ) => {
183+ const cardView = setup ( {
184+ keyExpr : 'id' ,
185+ dataSource : [ { id : 1 } , { id : 2 } ] ,
186+ selection : {
187+ mode : 'multiple' ,
188+ } ,
189+ selectedCardKeys : [ ] ,
190+ } ) ;
191+
192+ expect ( cardView . getSelectedCardKeys ( ) ) . toEqual ( [ ] ) ;
193+
194+ cardView . option ( 'selectedCardKeys' , [ 2 ] ) ;
195+
196+ expect ( cardView . getSelectedCardKeys ( ) ) . toEqual ( [ 2 ] ) ;
197+
198+ const clearSelectionButton = getClearSelectionButton ( ) ;
199+ clearSelectionButton ?. dispatchEvent ( new MouseEvent ( 'click' ) ) ;
200+
201+ expect ( cardView . getSelectedCardKeys ( ) ) . toEqual ( [ ] ) ;
202+ } ) ;
203+ } ) ;
204+
181205describe ( 'selectAll with filters' , ( ) => {
182206 it ( 'should select only cards matching filterValue' , ( ) => {
183207 const cardView = setup ( {
@@ -302,27 +326,3 @@ describe('selectAll with filters', () => {
302326 expect ( cardView . getSelectedCardKeys ( ) ) . toEqual ( [ 1 ] ) ;
303327 } ) ;
304328} ) ;
305-
306- describe ( 'clear selection toolbar button' , ( ) => {
307- it ( 'should clear selection after runtime selectedCardKeys option update' , ( ) => {
308- const cardView = setup ( {
309- keyExpr : 'id' ,
310- dataSource : [ { id : 1 } , { id : 2 } ] ,
311- selection : {
312- mode : 'multiple' ,
313- } ,
314- selectedCardKeys : [ ] ,
315- } ) ;
316-
317- expect ( cardView . getSelectedCardKeys ( ) ) . toEqual ( [ ] ) ;
318-
319- cardView . option ( 'selectedCardKeys' , [ 2 ] ) ;
320-
321- expect ( cardView . getSelectedCardKeys ( ) ) . toEqual ( [ 2 ] ) ;
322-
323- const clearSelectionButton = getClearSelectionButton ( ) ;
324- clearSelectionButton ?. dispatchEvent ( new MouseEvent ( 'click' ) ) ;
325-
326- expect ( cardView . getSelectedCardKeys ( ) ) . toEqual ( [ ] ) ;
327- } ) ;
328- } ) ;
0 commit comments