| OLD | NEW |
| 1 library scope_spec; | 1 library scope_spec; |
| 2 | 2 |
| 3 import '../_specs.dart'; | 3 import '../_specs.dart'; |
| 4 import 'dart:convert' show JSON; | 4 import 'dart:convert' show JSON; |
| 5 | 5 |
| 6 | 6 |
| 7 main() { | 7 main() { |
| 8 describe(r'Scope', () { | 8 describe(r'Scope', () { |
| 9 NgZone zone; | 9 NgZone zone; |
| 10 | 10 |
| 11 noop() {} | 11 noop() {} |
| 12 | 12 |
| 13 beforeEach(module(() { | 13 beforeEach(module(() { |
| 14 return (NgZone _zone) { | 14 return (NgZone _zone) { |
| 15 zone = _zone; | 15 zone = _zone; |
| 16 zone.onError = (e, s, l) => null; | 16 zone.onError = (e, s, l) => null; |
| 17 }; | 17 }; |
| 18 })); | 18 })); |
| 19 | 19 |
| 20 describe(r'$root', () { | 20 describe(r'$root', () { |
| 21 it(r'should point to itself', inject((Scope $rootScope) { | 21 it(r'should point to itself', inject((Scope $rootScope) { |
| 22 expect($rootScope.$root).toEqual($rootScope); | 22 expect($rootScope.$root).toEqual($rootScope); |
| 23 expect($rootScope.$root).toEqual($rootScope); |
| 23 expect($rootScope.$root).toBeTruthy(); | 24 expect($rootScope.$root).toBeTruthy(); |
| 24 })); | 25 })); |
| 25 | 26 |
| 26 | 27 |
| 27 it(r'should not have $root on children, but should inherit', inject((Scope
$rootScope) { | 28 it(r'should not have $root on children, but should inherit', inject((Scope
$rootScope) { |
| 28 var child = $rootScope.$new(); | 29 var child = $rootScope.$new(); |
| 29 expect(child.$root).toEqual($rootScope); | 30 expect(child.$root).toEqual($rootScope); |
| 30 expect(child._$root).toBeFalsy(); | 31 expect(child._$root).toBeFalsy(); |
| 31 })); | 32 })); |
| 32 | 33 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 }); | 100 }); |
| 100 expect(digestedValue).toEqual(0); | 101 expect(digestedValue).toEqual(0); |
| 101 zone.run(() { | 102 zone.run(() { |
| 102 $rootScope.$skipAutoDigest(); | 103 $rootScope.$skipAutoDigest(); |
| 103 }); | 104 }); |
| 104 expect(digestedValue).toEqual(0); | 105 expect(digestedValue).toEqual(0); |
| 105 zone.run(noop); | 106 zone.run(noop); |
| 106 expect(digestedValue).toEqual(1); | 107 expect(digestedValue).toEqual(1); |
| 107 })); | 108 })); |
| 108 | 109 |
| 110 it(r'should skip auto digest if requested on any scope', inject((Scope $ro
otScope) { |
| 111 var scope = $rootScope.$new(); |
| 112 var digestedValue = 0; |
| 113 scope.a = 1; |
| 114 scope.$watch('a', (newValue, oldValue, _this) { |
| 115 digestedValue = newValue; |
| 116 }); |
| 117 expect(digestedValue).toEqual(0); |
| 118 zone.run(() { |
| 119 scope.$skipAutoDigest(); |
| 120 }); |
| 121 expect(digestedValue).toEqual(0); |
| 122 zone.run(noop); |
| 123 expect(digestedValue).toEqual(1); |
| 124 })); |
| 125 |
| 109 it(r'should throw exception if asked to skip auto digest outside of a turn
', | 126 it(r'should throw exception if asked to skip auto digest outside of a turn
', |
| 110 inject((Scope $rootScope) { | 127 inject((Scope $rootScope) { |
| 111 var digestedValue = 0; | 128 var digestedValue = 0; |
| 112 $rootScope.a = 1; | 129 $rootScope.a = 1; |
| 113 $rootScope.$watch('a', (newValue, oldValue, _this) { | 130 $rootScope.$watch('a', (newValue, oldValue, _this) { |
| 114 digestedValue = newValue; | 131 digestedValue = newValue; |
| 115 }); | 132 }); |
| 116 expect(digestedValue).toEqual(0); | 133 expect(digestedValue).toEqual(0); |
| 117 expect($rootScope.$skipAutoDigest).toThrow(); | 134 expect($rootScope.$skipAutoDigest).toThrow(); |
| 118 })); | 135 })); |
| (...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 Iterable<T> takeWhile(bool test(T value)) => source.takeWhile(test); | 1330 Iterable<T> takeWhile(bool test(T value)) => source.takeWhile(test); |
| 1314 | 1331 |
| 1315 List<T> toList({bool growable: true}) => source.toList(growable: growable); | 1332 List<T> toList({bool growable: true}) => source.toList(growable: growable); |
| 1316 | 1333 |
| 1317 Set<T> toSet() => source.toSet(); | 1334 Set<T> toSet() => source.toSet(); |
| 1318 | 1335 |
| 1319 Iterable<T> where(bool test(T element)) => source.where(test); | 1336 Iterable<T> where(bool test(T element)) => source.where(test); |
| 1320 | 1337 |
| 1321 toJson() => source.toList(); | 1338 toJson() => source.toList(); |
| 1322 } | 1339 } |
| OLD | NEW |