Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 355b457

Browse files
committed
test(dccd): add map reference reassignment test
1 parent 7ae7454 commit 355b457

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/change_detection/dirty_checking_change_detector_spec.dart

+18-1
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ void addListSpec({bool useObservable}) {
977977
removals: []));
978978
}));
979979

980-
iit('should list reference changes', () {
980+
it('should handle list reference changes', () {
981981
var list = listFactory(['a']);
982982
var record = detector.watch(list, null, null);
983983
if (detector.collectChanges().moveNext()) {
@@ -1140,6 +1140,23 @@ void addMapSpec({bool useObservable}) {
11401140

11411141
expect(getChangeIterator().moveNext()).toEqual(false);
11421142
}));
1143+
1144+
iit('should handle map reference changes', wrap(() {
1145+
var map = mapFactory({'foo': 'bar'});
1146+
var record = detector.watch(map, null, 'handler');
1147+
1148+
expect(getChangeIterator().moveNext()).toEqual(true);
1149+
1150+
record.object = mapFactory({'bar': 'buz'});
1151+
var iterator = getChangeIterator();
1152+
expect(iterator.moveNext()).toEqual(true);
1153+
expect(iterator.current.currentValue, toEqualMapRecord(
1154+
map: [],
1155+
previous: ['a[A -> null]', 'd[D -> null]'],
1156+
additions: ['bar[null -> buz]'],
1157+
changes: [],
1158+
removals: ['foo[bar -> null]']));
1159+
}));
11431160
});
11441161
}
11451162

0 commit comments

Comments
 (0)