-
Notifications
You must be signed in to change notification settings - Fork 27.4k
RELEASE: Add BC note for ngClass deep watch change #16034
Comments
Normally this would be done in the commit message. How should this be done when the commit already exists (and doesn't have a "BREAKING CHANGE" message...)? |
We need to add this to the changelog once we create it for 1.7.0 or the first beta. You can post the text here so we have it. |
This one was rare and a little confusing, but here's a shot at a BC message:
|
Hm, it doesn't say anything about things that aren't supported anymore, does it? I.e. it should say what the devs cannot do anymore, and what they should do instead |
I'm starting to question if this actually effects Previously it did a deep watch if The rest of this change was allowing one-time literals to use input-watching. Previously without input-watching object/array literals would cause an infdig due to the new instance created each time. Since this case previously crashed I don't think there's any breaking change. I do have some tests to add which fail in v1.6.x but pass in master though... |
@jbedard, are you saying that the following is not true:
|
@gkalpak correct. While the I would still like to add more tests around the |
Ok, then we agree that this is not a BC. :) |
Here are some examples that pass in both 1.6 and 1.7. The "should not re-apply" cases are what I originally thought would re-apply in 1.6. fit('should not deep watch objects', inject(function($rootScope, $compile, $animate) {
$rootScope.classVar = {orange: {}};
element = $compile('<div ng-class="classVar"></div>')($rootScope);
var addSpy = spyOn($animate, "addClass").and.callThrough();
$rootScope.$digest();
expect(element).toHaveClass("orange");
expect(addSpy).toHaveBeenCalledTimes(1);
//Should not re-apply class when a deep property changes
$rootScope.classVar.orange.foo = 42;
$rootScope.$digest();
expect(element).toHaveClass("orange");
expect(addSpy).toHaveBeenCalledTimes(1);
//Should re-apply class when a direct property changes
$rootScope.classVar.apple = {};
$rootScope.$digest();
expect(element).toHaveClass("orange");
expect(element).toHaveClass("apple");
expect(addSpy).toHaveBeenCalledTimes(2);
}));
fit('should not deep watch array literals', inject(function($rootScope, $compile, $animate) {
$rootScope.classVar = {orange: {}};
element = $compile('<div ng-class="[classVar, classVar2]"></div>')($rootScope);
var addSpy = spyOn($animate, "addClass").and.callThrough();
$rootScope.$digest();
expect(element).toHaveClass("orange");
expect(addSpy).toHaveBeenCalledTimes(1);
//Should not re-apply class when a deep property changes
$rootScope.classVar.orange.foo = 42;
$rootScope.$digest();
expect(element).toHaveClass("orange");
expect(addSpy).toHaveBeenCalledTimes(1);
//Should re-apply class when a direct property changes
$rootScope.classVar.apple = {};
$rootScope.$digest();
expect(element).toHaveClass("orange");
expect(element).toHaveClass("apple");
expect(addSpy).toHaveBeenCalledTimes(2);
}));
fit('should not deep watch array literals (one-time)', inject(function($rootScope, $compile, $animate) {
$rootScope.classVar = {orange: {}};
element = $compile('<div ng-class="::[classVar, classVar2]"></div>')($rootScope);
var addSpy = spyOn($animate, "addClass").and.callThrough();
$rootScope.$digest();
expect(element).toHaveClass("orange");
expect(addSpy).toHaveBeenCalledTimes(1);
//Should not re-apply class when a deep property changes
$rootScope.classVar.orange.foo = 42;
$rootScope.$digest();
expect(element).toHaveClass("orange");
expect(addSpy).toHaveBeenCalledTimes(1);
//Should re-apply class when a direct property changes
$rootScope.classVar.apple = {};
$rootScope.$digest();
expect(element).toHaveClass("orange");
expect(element).toHaveClass("apple");
expect(addSpy).toHaveBeenCalledTimes(2);
})); |
Introduced in this commit: 189461f
Needs to be added before 1.7 is released
The text was updated successfully, but these errors were encountered: