Skip to content

Commit 0f4a882

Browse files
committed
refactor(benchmarks): simplify and clean up code
* Remove genrule to create styles.css * Import indigo-pink.scss via CheckboxBenchmarkApp's styleUrls * Set the view encapsulation of CheckboxBenchmarkApp to none so that the styles from indigo-pink.scss are applied to the whole page * Remove some unused imports * Add a comment to WORKSPACE to clarify what browser_repositories does * Add a todo comment to WORKSPACE to remind myself to deduplicate the chromium browsers * Change CheckboxBenchmarkApp's mat-checkbox so that indeterminate is a one-way binding * Moved @angular/dev-infra and @angular/benchpress from deps to dev deps
1 parent 01ca561 commit 0f4a882

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

WORKSPACE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ rbe_autoconfig(
130130
repository = "google/rbe-ubuntu16-04-webtest",
131131
)
132132

133+
# Load pinned rules_webtesting browser versions for tests.
134+
#
135+
# todo(wagnermaciel): deduplicate browsers - this will load another version of chromium in the
136+
# repository. We probably want to use the chromium version loaded here (from dev-infra) as that
137+
# one has RBE improvements.
133138
load("@npm_angular_dev_infra_private//benchmark/browsers:browser_repositories.bzl", "browser_repositories")
134139

135140
browser_repositories()

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
},
4646
"version": "9.2.0-next.0",
4747
"dependencies": {
48-
"@angular/benchpress": "^0.2.0",
49-
"@angular/dev-infra": "file:../dev-infra",
5048
"@angular-devkit/build-optimizer": "^0.900.6",
5149
"@angular/animations": "^9.1.0-next.4",
5250
"@angular/common": "^9.1.0-next.4",
@@ -68,6 +66,8 @@
6866
"zone.js": "~0.10.2"
6967
},
7068
"devDependencies": {
69+
"@angular/benchpress": "^0.2.0",
70+
"@angular/dev-infra": "file:../dev-infra",
7171
"@angular-devkit/core": "^9.0.4",
7272
"@angular-devkit/schematics": "^9.0.4",
7373
"@angular/bazel": "^9.1.0-next.4",

test/benchmarks/material/checkbox/BUILD.bazel

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
load("@npm_angular_dev_infra_private//benchmark/component_benchmark:component_benchmark.bzl", "component_benchmark")
22

3-
genrule(
4-
name = "indigo-pink",
5-
srcs = ["//src/material/core:theming/prebuilt/indigo-pink.css"],
6-
outs = ["styles.css"],
7-
cmd = "cp $< $@",
8-
)
9-
103
# todo(wagnermaciel): If assets are defined and no index.html is provided, throw error with clear error message.
114
component_benchmark(
125
name = "benchmark",
@@ -23,6 +16,6 @@ component_benchmark(
2316
"//src/cdk/a11y",
2417
],
2518
ng_srcs = [":app.module.ts"],
26-
styles = [":indigo-pink"],
19+
styles = ["//src/material/prebuilt-themes:indigo-pink"],
2720
prefix = "",
2821
)

test/benchmarks/material/checkbox/app.module.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import { A11yModule } from '@angular/cdk/a11y';
9-
import { Component, NgModule, ViewChild } from '@angular/core';
9+
import { Component, NgModule, ViewEncapsulation } from '@angular/core';
1010
import { BrowserModule } from '@angular/platform-browser';
11-
import { MatCheckboxModule, MatCheckbox } from '@angular/material/checkbox';
11+
import { MatCheckboxModule } from '@angular/material/checkbox';
1212

1313
/**
1414
* @title Checkbox benchmark component.
@@ -23,12 +23,13 @@ import { MatCheckboxModule, MatCheckbox } from '@angular/material/checkbox';
2323
<ng-container *ngIf="isVisible">
2424
<mat-checkbox
2525
[checked]="isChecked"
26-
[(indeterminate)]="isIndeterminate"
26+
[indeterminate]="isIndeterminate"
2727
(change)="toggleIsChecked()"
2828
>Check me!</mat-checkbox>
2929
</ng-container>
3030
`,
31-
styles: [],
31+
encapsulation: ViewEncapsulation.None,
32+
styleUrls: ['//src/material/core/theming/prebuilt/indigo-pink.css'],
3233
})
3334
export class CheckboxBenchmarkApp {
3435
isChecked = false;

0 commit comments

Comments
 (0)