diff --git a/scripts/fiber/tests-passing.txt b/scripts/fiber/tests-passing.txt index 2c72ecdb4cd9..270aceb99970 100644 --- a/scripts/fiber/tests-passing.txt +++ b/scripts/fiber/tests-passing.txt @@ -964,6 +964,7 @@ src/renderers/dom/shared/__tests__/ReactBrowserEventEmitter-test.js * should continue bubbling if an error is thrown * should set currentTarget * should support stopPropagation() +* should support overriding .isPropagationStopped() * should stop after first dispatch if stopPropagation * should not stopPropagation if false is returned * should invoke handlers that were removed while bubbling diff --git a/src/renderers/dom/shared/__tests__/ReactBrowserEventEmitter-test.js b/src/renderers/dom/shared/__tests__/ReactBrowserEventEmitter-test.js index 79eaef9377b6..9ba9e36a2b10 100644 --- a/src/renderers/dom/shared/__tests__/ReactBrowserEventEmitter-test.js +++ b/src/renderers/dom/shared/__tests__/ReactBrowserEventEmitter-test.js @@ -325,6 +325,33 @@ describe('ReactBrowserEventEmitter', () => { expect(idCallOrder[1]).toBe(PARENT); }); + it('should support overriding .isPropagationStopped()', () => { + // Ew. See D4504876. + putListener( + CHILD, + ON_CLICK_KEY, + recordID.bind(null, CHILD) + ); + putListener( + PARENT, + ON_CLICK_KEY, + function(e) { + recordID(PARENT, e); + // This stops React bubbling but avoids touching the native event + e.isPropagationStopped = () => true; + } + ); + putListener( + GRANDPARENT, + ON_CLICK_KEY, + recordID.bind(null, GRANDPARENT) + ); + ReactTestUtils.Simulate.click(CHILD); + expect(idCallOrder.length).toBe(2); + expect(idCallOrder[0]).toBe(CHILD); + expect(idCallOrder[1]).toBe(PARENT); + }); + it('should stop after first dispatch if stopPropagation', () => { putListener( CHILD,