Skip to content

Commit

Permalink
Components: Add test for withGlobalEvents HOC
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Apr 12, 2018
1 parent fa89a1d commit c41e84d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions components/higher-order/with-global-events/test/listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,18 @@ describe( 'Listener', () => {

expect( handler.handleEvent ).toHaveBeenCalledWith( event );
} );

it( 'calls all added handlers', () => {
const handler = createHandler();
listener.add( 'resize', handler );
listener.add( 'resize', handler );
listener.add( 'resize', handler );

const event = { type: 'resize' };

listener.handleEvent( event );

expect( handler.handleEvent ).toHaveBeenCalledTimes( 3 );
} );
} );
} );

0 comments on commit c41e84d

Please sign in to comment.