From cb14f3cd71f41f2c852d4dc669caffd60551ef7c Mon Sep 17 00:00:00 2001 From: Simon Hofer Date: Fri, 14 Feb 2014 10:18:49 +0100 Subject: [PATCH] Use element comparison instead of reference comparison when observing changes to Iterables in a scope. --- lib/core/scope.dart | 2 +- test/core/scope_spec.dart | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/core/scope.dart b/lib/core/scope.dart index 6d1d004c6..f3f9971ed 100644 --- a/lib/core/scope.dart +++ b/lib/core/scope.dart @@ -372,7 +372,7 @@ class Scope implements Map { $watchCollectionWatch = (_) { newValue = objGetter(this, _filters); - if (newValue is! Map && newValue is! List) { + if (newValue is! Map && newValue is! Iterable) { if (!_identical(oldValue, newValue)) { oldValue = newValue; changeDetected++; diff --git a/test/core/scope_spec.dart b/test/core/scope_spec.dart index 4f284f0c9..075237145 100644 --- a/test/core/scope_spec.dart +++ b/test/core/scope_spec.dart @@ -1077,6 +1077,15 @@ main() { log = []; $rootScope.$digest(); expect(log).toEqual(['["b",[],{}]']); + + $rootScope.obj = _toJsonableIterable(['a']); + log = []; + $rootScope.$digest(); + expect(log).toEqual(['["a"]']); + + $rootScope.obj = _toJsonableIterable(['a']); + $rootScope.$digest(); + expect(log).toEqual(['["a"]']); });