-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($compile): Cleanup attribute-binding observers #15298
Conversation
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 implementation looks good. The testcase doesn't seem to test the new change, though.
Off the top of my head, you can exercise the appropriate path by having a controller that returns an object from its constructor. E.g. something like:
function TestController() {
return {
$onChanges: ...
};
}
TestController.prototype.$onChanges = ...
In thie above case, both $onChanges
functions should continue to get called without the fix. With your fix, only the returned one should continue to get called onve the controller is initialized.
var constructorSpy = jasmine.createSpy('constructor'); | ||
var prototypeSpy = jasmine.createSpy('prototype'); | ||
|
||
function TestDirective() { |
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.
Nit: Rename to TestController
.
LGTM 👍 (I will rename the controller while merging.) ✨ Thx for finding the bug and fixing it too! ✨ |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix
What is the current behavior? (You can also link to an open issue here)
#15268
What is the new behavior (if this is a feature change)?
Cleans up attributes observer on change.
Does this PR introduce a breaking change?
No.
Please check if the PR fulfills these requirements
Other information: