Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Emit scale does not always pass events #261

Merged
merged 5 commits into from
Jul 29, 2017
Merged

Fix: Emit scale does not always pass events #261

merged 5 commits into from
Jul 29, 2017

Conversation

Minh-Ng
Copy link
Contributor

@Minh-Ng Minh-Ng commented Jul 29, 2017

Thanks to @pramodsum for the catch.
Fancy destructure syntax was no good here.

}
};

base.addCommonListeners();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is actually checking any expectations. I'd just do something like

this.annotationPromise = {};
base.emit('load', ....);
expect(base.loadAnnotor).to.be.called;

etc. for w/e is called and check that scale is set if it exists in event.scale

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expectation is that the annotations promise is called. done() is only resolved when the annotations promise is called. Unfortunately we cannot expect base.loadAnnotator to be called since events are async.

I've added a check to ensure that base.scale is set and that base.loadAnnotator is passed into the promise.then function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops you're right. Totally missed that! This works 👍

}
};

base.addCommonListeners();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops you're right. Totally missed that! This works 👍

@Minh-Ng Minh-Ng merged commit 41b1af0 into box:master Jul 29, 2017
@Minh-Ng Minh-Ng deleted the fix/noDestructure branch July 29, 2017 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants