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 7, 2016
1 parent 9c48a80 commit 10ddaff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ShallowWrapper.js
Expand Up @@ -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();
});
Expand Down

0 comments on commit 10ddaff

Please sign in to comment.