From c41e84d4679c3cc28efb26a8e972015efe451589 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Thu, 12 Apr 2018 10:28:45 +0200 Subject: [PATCH] Components: Add test for withGlobalEvents HOC --- .../with-global-events/test/listener.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/higher-order/with-global-events/test/listener.js b/components/higher-order/with-global-events/test/listener.js index 8235cd819c806..53f5db9a3298d 100644 --- a/components/higher-order/with-global-events/test/listener.js +++ b/components/higher-order/with-global-events/test/listener.js @@ -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 ); + } ); } ); } );