Skip to content

Commit

Permalink
for loop instead of do while
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno Campos committed May 8, 2016
1 parent a11a2a5 commit 6920d0d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ShallowWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit 6920d0d

Please sign in to comment.