diff --git a/src/ShallowWrapper.js b/src/ShallowWrapper.js index a0010ccff..444b30873 100644 --- a/src/ShallowWrapper.js +++ b/src/ShallowWrapper.js @@ -351,15 +351,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(); });