Skip to content

Commit bf160e8

Browse files
committed
fixup! test(button-harness): add performance tests for buttons using the protractor harness env
1 parent 72a4ae0 commit bf160e8

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

test/benchmarks/material/button-harness/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ ng_test_library(
6868
deps = [
6969
":constants",
7070
":testbed-benchmark-utilities",
71-
"//src/material/button/testing",
7271
"//src/cdk/testing",
7372
"//src/cdk/testing/testbed",
7473
"//src/material/button",
74+
"//src/material/button/testing",
7575
"@npm//@angular/dev-infra-private",
7676
],
7777
)

test/benchmarks/material/button-harness/app.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {BrowserModule} from '@angular/platform-browser';
1111
import {MatButtonModule} from '@angular/material/button';
1212
import {NUM_BUTTONS} from './constants';
1313

14-
/** component: mat-raised-button-harness-test */
14+
/** component: mat-button-harness-test */
1515

1616
@Component({
1717
selector: 'app-root',

test/benchmarks/material/button-harness/protractor-benchmark-utilities.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ export async function benchmark(id: string, callback: Function) {
3030
* @param callback
3131
*/
3232
async function benchmarkWithBenchpress(id: string, callback: Function) {
33-
await runBenchmark({
34-
id,
35-
url: '',
36-
ignoreBrowserSynchronization: true,
37-
params: [],
38-
work: async () => await callback(),
39-
});
33+
await runBenchmark({
34+
id,
35+
url: '',
36+
ignoreBrowserSynchronization: true,
37+
params: [],
38+
work: async () => await callback(),
39+
});
4040
}
4141

4242
/**
@@ -46,7 +46,7 @@ async function benchmarkWithBenchpress(id: string, callback: Function) {
4646
* @param callback
4747
*/
4848
async function benchmarkWithConsoleAPI(id: string, callback: Function) {
49-
console.time(id);
50-
await callback();
51-
console.timeEnd(id);
49+
console.time(id);
50+
await callback();
51+
console.timeEnd(id);
5252
}

test/benchmarks/material/button-harness/protractor.perf-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {HarnessLoader, HarnessPredicate} from '@angular/cdk/testing';
9+
import {HarnessLoader} from '@angular/cdk/testing';
1010
import {MatButtonHarness} from '@angular/material/button/testing/button-harness';
1111
import {ProtractorHarnessEnvironment} from '@angular/cdk/testing/protractor';
1212
import {$$, element, by, browser} from 'protractor';

test/benchmarks/material/button-harness/testbed-benchmark-utilities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
/**
9+
/**
1010
* Records the performance of the given function.
1111
*
1212
* @param id A unique identifier.
1313
* @param callback A function whose performance will be recorded.
1414
*/
1515
export async function benchmark(id: string, callback: Function) {
16-
const t0 = performance.now();
16+
const t0 = performance.now();
1717
await callback();
1818
const t1 = performance.now();
1919
console.warn(`${id}: ${t1 - t0}`);

test/benchmarks/material/button-harness/testbed.perf-spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ describe('performance baseline for the testbed harness', () => {
4444
it('(baseline) should click the middle button', async () => {
4545
await benchmark('(baseline) click middle button', async () => {
4646
const button = getButtonWithText(MIDDLE_BUTTON);
47-
await button.click();
47+
button.click();
4848
});
4949
});
5050

5151
it('(baseline) should click the last button', async () => {
5252
await benchmark('(baseline) click last button', async () => {
5353
const button = getButtonWithText(LAST_BUTTON);
54-
await button.click();
54+
button.click();
5555
});
5656
});
5757

@@ -60,7 +60,7 @@ describe('performance baseline for the testbed harness', () => {
6060
const buttons = document.getElementsByTagName('button');
6161
for (let i = 0; i < buttons.length; i++) {
6262
const button = buttons[i];
63-
await button.click();
63+
button.click();
6464
}
6565
});
6666
});
@@ -128,8 +128,8 @@ describe('performance tests for the testbed harness', () => {
128128
@Component({
129129
template: `
130130
<button *ngFor="let val of vals" mat-button> {{ val }} </button>
131-
`,
131+
`,
132132
})
133133
export class ButtonHarnessTest {
134-
vals = Array.from({ length: NUM_BUTTONS }, (_, i) => i);
134+
vals = Array.from({ length: NUM_BUTTONS }, (_, i) => i);
135135
}

0 commit comments

Comments
 (0)