Revert "feat(iterable_differ): support immutable lists"
In Dart, ImmutableLists are just a projection of an underlying list.
I.e. if the underlying list changes, the ImmutableList also changes.
So we can't make optimizations based on checking whether a collection
is an ImmutableList.
This reverts commit a10c02cb41
.
Closes #8023
This commit is contained in:
@ -31,6 +31,7 @@ class ComplexItem {
|
||||
toString() { return `{id: ${this.id}, color: ${this.color}}` }
|
||||
}
|
||||
|
||||
// todo(vicb): UnmodifiableListView / frozen object when implemented
|
||||
export function main() {
|
||||
describe('iterable differ', function() {
|
||||
describe('DefaultIterableDiffer', function() {
|
||||
@ -313,36 +314,6 @@ export function main() {
|
||||
}));
|
||||
});
|
||||
|
||||
it('should not diff immutable collections if they are the same', () => {
|
||||
// Note: Use trackBy to know if diffing happened
|
||||
var trackByCount = 0;
|
||||
var trackBy = (index: number, item: any): any => {
|
||||
trackByCount++;
|
||||
return item;
|
||||
};
|
||||
var differ = new DefaultIterableDiffer(trackBy);
|
||||
var l1 = ListWrapper.createImmutable([1]);
|
||||
|
||||
differ.check(l1);
|
||||
expect(trackByCount).toBe(1);
|
||||
expect(differ.toString())
|
||||
.toEqual(
|
||||
iterableChangesAsString({collection: ['1[null->0]'], additions: ['1[null->0]']}));
|
||||
|
||||
|
||||
trackByCount = 0;
|
||||
differ.check(l1);
|
||||
expect(trackByCount).toBe(0);
|
||||
expect(differ.toString())
|
||||
.toEqual(iterableChangesAsString({collection: ['1'], previous: ['1']}));
|
||||
|
||||
trackByCount = 0;
|
||||
differ.check(l1);
|
||||
expect(trackByCount).toBe(0);
|
||||
expect(differ.toString())
|
||||
.toEqual(iterableChangesAsString({collection: ['1'], previous: ['1']}));
|
||||
});
|
||||
|
||||
describe('diff', () => {
|
||||
it('should return self when there is a change',
|
||||
() => { expect(differ.diff(['a', 'b'])).toBe(differ); });
|
||||
|
Reference in New Issue
Block a user