-
Notifications
You must be signed in to change notification settings - Fork 113
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
Conversation
} | ||
}; | ||
|
||
base.addCommonListeners(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 👍
Thanks to @pramodsum for the catch.
Fancy destructure syntax was no good here.