| 
									
										
										
										
											2015-04-26 11:35:25 -07:00
										 |  |  | var perfUtil = require('angular2/src/test_lib/perf_util'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe('ng2 cost benchmark', function () { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   var URL = 'benchmarks/src/costs/index.html'; | 
					
						
							| 
									
										
										
										
											2015-04-26 12:15:42 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Number of components to create in a single iteration | 
					
						
							| 
									
										
										
										
											2015-04-26 11:35:25 -07:00
										 |  |  |   var benchmarkSize = 200; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   afterEach(perfUtil.verifyNoBrowserErrors); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('should log stats for baseline (plain components)', function(done) { | 
					
						
							|  |  |  |     perfUtil.runClickBenchmark({ | 
					
						
							|  |  |  |       url: URL, | 
					
						
							|  |  |  |       buttons: ['#reset', '#createPlainComponents'], | 
					
						
							|  |  |  |       id: 'ng2.costs.baseline', | 
					
						
							|  |  |  |       params: [{ | 
					
						
							| 
									
										
										
										
											2015-04-26 12:15:42 -07:00
										 |  |  |         name: 'size', value: benchmarkSize, scale: 'linear' | 
					
						
							| 
									
										
										
										
											2015-04-26 11:35:25 -07:00
										 |  |  |       }] | 
					
						
							|  |  |  |     }).then(done, done.fail); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('should log stats for components with decorators', function(done) { | 
					
						
							|  |  |  |     perfUtil.runClickBenchmark({ | 
					
						
							|  |  |  |       url: URL, | 
					
						
							| 
									
										
										
										
											2015-04-30 13:38:40 -07:00
										 |  |  |       buttons: ['#reset', '#createComponentsWithDirectives'], | 
					
						
							| 
									
										
										
										
											2015-04-26 11:35:25 -07:00
										 |  |  |       id: 'ng2.costs.decorators', | 
					
						
							|  |  |  |       params: [{ | 
					
						
							| 
									
										
										
										
											2015-04-26 12:15:42 -07:00
										 |  |  |         name: 'size', value: benchmarkSize, scale: 'linear' | 
					
						
							|  |  |  |       }] | 
					
						
							|  |  |  |     }).then(done, done.fail); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   it('should log stats for dynamic components', function(done) { | 
					
						
							|  |  |  |     perfUtil.runClickBenchmark({ | 
					
						
							|  |  |  |       url: URL, | 
					
						
							|  |  |  |       buttons: ['#reset', '#createDynamicComponents'], | 
					
						
							|  |  |  |       id: 'ng2.costs.dynamic', | 
					
						
							|  |  |  |       params: [{ | 
					
						
							|  |  |  |         name: 'size', value: benchmarkSize, scale: 'linear' | 
					
						
							| 
									
										
										
										
											2015-04-26 11:35:25 -07:00
										 |  |  |       }] | 
					
						
							|  |  |  |     }).then(done, done.fail); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | }); |