feat(benchmarks): add detectChanges test for ng2 tree benchmark

This commit is contained in:
Tobias Bosch
2016-12-28 15:26:49 -08:00
committed by Igor Minar
parent c5c53f3666
commit 50e5cb15dd
5 changed files with 44 additions and 3 deletions

View File

@ -132,13 +132,25 @@ describe('tree benchmark perf', () => {
}).then(done, done.fail);
});
});
it('should run ng2 changedetection', (done) => {
runTreeBenchmark({
id: `deepTree.ng2.changedetection`,
url: 'all/benchmarks/src/tree/ng2/index.html',
work: () => $('#detectChanges').click(),
setup: () => $('#createDom').click(),
}).then(done, done.fail);
});
});
function runTreeBenchmark(config: {
id: string,
url: string, ignoreBrowserSynchronization?: boolean,
work: () => any,
prepare: () => any, extraParams?: {name: string, value: any}[]
prepare?: () => any,
extraParams?: {name: string, value: any}[],
setup?: () => any
}) {
let params = [{name: 'depth', value: 11}];
if (config.extraParams) {
@ -150,7 +162,8 @@ describe('tree benchmark perf', () => {
ignoreBrowserSynchronization: config.ignoreBrowserSynchronization,
params: params,
work: config.work,
prepare: config.prepare
prepare: config.prepare,
setup: config.setup
});
}
});

View File

@ -19,6 +19,13 @@ describe('tree benchmark spec', () => {
});
});
it('should work for ng2 detect changes', () => {
let params = [{name: 'depth', value: 4}];
openBrowser({url: 'all/benchmarks/src/tree/ng2/index.html'});
$('#detectChanges').click();
expect($('#numberOfChecks').getText()).toContain('10');
});
it('should work for ng2 ftl', () => {
testTreeBenchmark({
url: 'all/benchmarks/src/tree/ng2_ftl/index.html',