Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/fiber/tests-passing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down