| OLD | NEW |
| 1 import '_perf.dart'; | 1 import '_perf.dart'; |
| 2 | 2 |
| 3 main() => describe('compiler', () { | 3 main() => describe('compiler', () { |
| 4 describe('block instantiation', () { | 4 describe('block instantiation', () { |
| 5 it('time ', inject((TestBed tb) { | 5 iit('time ', inject((TestBed tb) { |
| 6 tb.compile(UL_REPEATER); | 6 tb.compile(UL_REPEATER); |
| 7 var items = []; | 7 var items = []; |
| 8 for(var i = 0; i < 100; i++) { | 8 for(var i = 0; i < 100; i++) { |
| 9 items.add({"text":'text_$i', "done": i & 1 == 1}); | 9 items.add({"text":'text_$i', "done": i & 1 == 1}); |
| 10 } | 10 } |
| 11 var empty = []; | 11 var empty = []; |
| 12 tb.rootScope.context['classFor'] = (item) => 'ng-${item["done"]}'; | 12 tb.rootScope.classFor = (item) => 'ng-${item["done"]}'; |
| 13 | 13 |
| 14 time('create 100 blocks', | 14 time('create 100 blocks', |
| 15 () => tb.rootScope.apply(() => tb.rootScope.context['items'] = items), | 15 () => tb.rootScope.$apply(() => tb.rootScope.items = items), |
| 16 cleanUp: () => tb.rootScope.apply(() => tb.rootScope.context['items']
= empty), | 16 cleanUp: () => tb.rootScope.$apply(() => tb.rootScope.items = empty), |
| 17 verify: () => expect(tb.rootElement.querySelectorAll('li').length).toE
qual(100)); | 17 verify: () => expect(tb.rootElement.querySelectorAll('li').length).toE
qual(100)); |
| 18 })); | 18 })); |
| 19 }); | 19 }); |
| 20 }); | 20 }); |
| 21 | 21 |
| 22 var UL_REPEATER = | 22 var UL_REPEATER = |
| 23 """ | 23 """ |
| 24 <ul class="well unstyled"> | 24 <ul class="well unstyled"> |
| 25 <li ng-repeat="item in items" ng-class="classFor(item)"> | 25 <li ng-repeat="item in items" ng-class="classFor(item)"> |
| 26 <label class="checkbox"> | 26 <label class="checkbox"> |
| 27 <input type="checkbox" ng-model="item.done"> {{item.text}} | 27 <input type="checkbox" ng-model="item.done"> {{item.text}} |
| 28 </label> | 28 </label> |
| 29 </li> | 29 </li> |
| 30 </ul> | 30 </ul> |
| 31 """; | 31 """; |
| OLD | NEW |