diff --git a/src/ShallowWrapper.js b/src/ShallowWrapper.js index ebea10d30..0d798d817 100644 --- a/src/ShallowWrapper.js +++ b/src/ShallowWrapper.js @@ -353,15 +353,15 @@ export default class ShallowWrapper { const eventProp = propFromEvent(event); const e = Object.assign(new SyntheticEvent(undefined, undefined, { type: event }), mock); withSetStateAllowed(() => { - let current = this; - - do { + for (let current = this; current.node !== undefined; current = current.parent()) { const handler = current.prop(eventProp); if (handler) { handler(e, ...args); + if (e.isPropagationStopped()) { + break; + } } - current = current.parent(); - } while (!e.isPropagationStopped() && current.node !== undefined); + } this.root.update(); });