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