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

Commit c9776b4

Browse files
committed
fix(watch group): Fixed WatchGroup.toString(), added a test.
1 parent e233f5e commit c9776b4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/change_detection/watch_group.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ class WatchGroup implements _EvalWatchList, _WatchGroupList {
353353
lines.add('WatchGroup[$id](watches: ${watches.join(', ')})');
354354
var childGroup = _watchGroupHead;
355355
while (childGroup != null) {
356-
lines.add(' ' + childGroup.toString().replace('\n', '\n '));
356+
lines.add(' ' + childGroup.toString().replaceAll('\n', '\n '));
357357
childGroup = childGroup._nextWatchGroup;
358358
}
359359
return lines.join('\n');

test/change_detection/watch_group_spec.dart

+10
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ void main() {
7171
logger = _logger;
7272
}));
7373

74+
it('should have a toString for debugging', () {
75+
watchGrp.watch(parse('a'), (v, p) {});
76+
watchGrp.newGroup({});
77+
expect("$watchGrp").toEqual(
78+
'WATCHES: MARKER[null], MARKER[null]\n'
79+
'WatchGroup[](watches: MARKER[null])\n'
80+
' WatchGroup[.0](watches: MARKER[null])'
81+
);
82+
});
83+
7484
describe('watch lifecycle', () {
7585
it('should prevent reaction fn on removed', () {
7686
context['a'] = 'hello';

0 commit comments

Comments
 (0)