@@ -383,6 +383,14 @@ describe('<IndexTable>', () => {
383383 } ) ;
384384
385385 describe ( 'BulkActions' , ( ) => {
386+ const originalInnerWidth = window . innerWidth ;
387+
388+ afterEach ( ( ) => {
389+ Object . defineProperty ( window , 'innerWidth' , {
390+ value : originalInnerWidth ,
391+ } ) ;
392+ } ) ;
393+
386394 it ( 'toggles all resources selected when paginatedSelectionAllAction is triggered' , ( ) => {
387395 const onSelectionChangeSpy = jest . fn ( ) ;
388396 const index = mountWithApp (
@@ -452,6 +460,65 @@ describe('<IndexTable>', () => {
452460 true ,
453461 ) ;
454462 } ) ;
463+
464+ it ( 'passes smallScreen to bulk actions' , ( ) => {
465+ const promotedActions = [ { content : 'PromotedAction' } ] ;
466+
467+ const indexTable = mountWithApp (
468+ < IndexTable
469+ { ...defaultProps }
470+ selectable
471+ selectedItemsCount = { 1 }
472+ itemCount = { 2 }
473+ promotedBulkActions = { promotedActions }
474+ >
475+ { mockTableItems . map ( mockRenderCondensedRow ) }
476+ </ IndexTable > ,
477+ ) ;
478+
479+ indexTable . find ( BulkActions ) ! . trigger ( 'onToggleAll' ) ;
480+
481+ expect ( indexTable ) . toContainReactComponent ( BulkActions , {
482+ smallScreen : expect . any ( Boolean ) ,
483+ } ) ;
484+ } ) ;
485+
486+ it ( 'passes an updated smallScreen value to bulk actions after resize' , ( ) => {
487+ Object . defineProperty ( window , 'innerWidth' , {
488+ value : 1000 ,
489+ } ) ;
490+
491+ const promotedActions = [ { content : 'PromotedAction' } ] ;
492+
493+ const indexTable = mountWithApp (
494+ < IndexTable
495+ { ...defaultProps }
496+ selectable
497+ selectedItemsCount = { 1 }
498+ itemCount = { 2 }
499+ promotedBulkActions = { promotedActions }
500+ >
501+ { mockTableItems . map ( mockRenderCondensedRow ) }
502+ </ IndexTable > ,
503+ ) ;
504+
505+ indexTable . find ( BulkActions ) ! . trigger ( 'onToggleAll' ) ;
506+
507+ expect ( indexTable ) . toContainReactComponent ( BulkActions , {
508+ smallScreen : false ,
509+ } ) ;
510+
511+ indexTable . act ( ( ) => {
512+ Object . defineProperty ( window , 'innerWidth' , {
513+ value : 300 ,
514+ } ) ;
515+ window . dispatchEvent ( new Event ( 'resize' ) ) ;
516+ } ) ;
517+
518+ expect ( indexTable ) . toContainReactComponent ( BulkActions , {
519+ smallScreen : true ,
520+ } ) ;
521+ } ) ;
455522 } ) ;
456523
457524 describe ( 'condensed' , ( ) => {
0 commit comments