Skip to content

refactor(table-benchmark): move template to a separate html file #19977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/benchmarks/material/table/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ component_benchmark(
"@npm//protractor",
"@npm//@types/jasmine",
],
ng_assets = [
":app.module.html",
":basic-table.html",
],
ng_deps = [
"@npm//@angular/core",
"@npm//@angular/platform-browser",
Expand Down
16 changes: 1 addition & 15 deletions test/benchmarks/material/table/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,7 @@ import {
// tslint:disable:max-line-length
@Component({
selector: 'app-root',
template: `
<button id="hide" (click)="hide()">Hide</button>
<button id="show-10-rows-5-cols" (click)="showTenRowsFiveCols()">Show 10 Rows 5 Cols</button>
<button id="show-100-rows-5-cols" (click)="showOneHundredRowsFiveCols()">Show 100 Rows 5 Cols</button>
<button id="show-1000-rows-5-cols" (click)="showOneThousandRowsFiveCols()">Show 1000 Rows 5 Cols</button>
<button id="show-10-rows-10-cols" (click)="showTenRowsTenCols()">Show 10 Rows 10 Cols</button>
<button id="show-10-rows-20-cols" (click)="showTenRowsTwentyCols()">Show 10 Rows 20 Cols</button>

<basic-table [rows]="tenRows" [cols]="fiveCols" *ngIf="isTenRowsFiveColsVisible"></basic-table>
<basic-table [rows]="oneHundredRows" [cols]="fiveCols" *ngIf="isOneHundredRowsFiveColsVisible"></basic-table>
<basic-table [rows]="oneThousandRows" [cols]="fiveCols" *ngIf="isOneThousandRowsFiveColsVisible"></basic-table>

<basic-table [rows]="tenRows" [cols]="tenCols" *ngIf="isTenRowsTenColsVisible"></basic-table>
<basic-table [rows]="tenRows" [cols]="twentyCols" *ngIf="isTenRowsTwentyColsVisible"></basic-table>
`,
templateUrl: './app.module.html',
encapsulation: ViewEncapsulation.None,
styleUrls: ['//src/material/core/theming/prebuilt/indigo-pink.css'],
})
Expand Down
104 changes: 104 additions & 0 deletions test/benchmarks/material/table/basic-table.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<table mat-table [dataSource]="rows" class="mat-elevation-z8">
<ng-container matColumnDef="a">
<th mat-header-cell *matHeaderCellDef> A </th>
<td mat-cell *matCellDef="let cell"> {{cell.a}} </td>
</ng-container>

<ng-container matColumnDef="b">
<th mat-header-cell *matHeaderCellDef> B </th>
<td mat-cell *matCellDef="let cell"> {{cell.b}} </td>
</ng-container>

<ng-container matColumnDef="c">
<th mat-header-cell *matHeaderCellDef> C </th>
<td mat-cell *matCellDef="let cell"> {{cell.c}} </td>
</ng-container>

<ng-container matColumnDef="d">
<th mat-header-cell *matHeaderCellDef> D </th>
<td mat-cell *matCellDef="let cell"> {{cell.d}} </td>
</ng-container>

<ng-container matColumnDef="e">
<th mat-header-cell *matHeaderCellDef> E </th>
<td mat-cell *matCellDef="let cell"> {{cell.e}} </td>
</ng-container>

<ng-container matColumnDef="f">
<th mat-header-cell *matHeaderCellDef> F </th>
<td mat-cell *matCellDef="let cell"> {{cell.f}} </td>
</ng-container>

<ng-container matColumnDef="g">
<th mat-header-cell *matHeaderCellDef> G </th>
<td mat-cell *matCellDef="let cell"> {{cell.g}} </td>
</ng-container>

<ng-container matColumnDef="h">
<th mat-header-cell *matHeaderCellDef> H </th>
<td mat-cell *matCellDef="let cell"> {{cell.h}} </td>
</ng-container>

<ng-container matColumnDef="i">
<th mat-header-cell *matHeaderCellDef> I </th>
<td mat-cell *matCellDef="let cell"> {{cell.i}} </td>
</ng-container>

<ng-container matColumnDef="j">
<th mat-header-cell *matHeaderCellDef> J </th>
<td mat-cell *matCellDef="let cell"> {{cell.j}} </td>
</ng-container>

<ng-container matColumnDef="k">
<th mat-header-cell *matHeaderCellDef> K </th>
<td mat-cell *matCellDef="let cell"> {{cell.k}} </td>
</ng-container>

<ng-container matColumnDef="l">
<th mat-header-cell *matHeaderCellDef> L </th>
<td mat-cell *matCellDef="let cell"> {{cell.l}} </td>
</ng-container>

<ng-container matColumnDef="m">
<th mat-header-cell *matHeaderCellDef> M </th>
<td mat-cell *matCellDef="let cell"> {{cell.m}} </td>
</ng-container>

<ng-container matColumnDef="n">
<th mat-header-cell *matHeaderCellDef> N </th>
<td mat-cell *matCellDef="let cell"> {{cell.n}} </td>
</ng-container>

<ng-container matColumnDef="o">
<th mat-header-cell *matHeaderCellDef> O </th>
<td mat-cell *matCellDef="let cell"> {{cell.o}} </td>
</ng-container>

<ng-container matColumnDef="p">
<th mat-header-cell *matHeaderCellDef> P </th>
<td mat-cell *matCellDef="let cell"> {{cell.p}} </td>
</ng-container>

<ng-container matColumnDef="q">
<th mat-header-cell *matHeaderCellDef> Q </th>
<td mat-cell *matCellDef="let cell"> {{cell.q}} </td>
</ng-container>

<ng-container matColumnDef="r">
<th mat-header-cell *matHeaderCellDef> R </th>
<td mat-cell *matCellDef="let cell"> {{cell.r}} </td>
</ng-container>

<ng-container matColumnDef="s">
<th mat-header-cell *matHeaderCellDef> S </th>
<td mat-cell *matCellDef="let cell"> {{cell.s}} </td>
</ng-container>

<ng-container matColumnDef="t">
<th mat-header-cell *matHeaderCellDef> T </th>
<td mat-cell *matCellDef="let cell"> {{cell.t}} </td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="cols"></tr>
<tr mat-row *matRowDef="let row; columns: cols;"></tr>
</table>
108 changes: 1 addition & 107 deletions test/benchmarks/material/table/basic-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,113 +10,7 @@ import {Component, Input} from '@angular/core';

@Component({
selector: 'basic-table',
template: `
<table mat-table [dataSource]="rows" class="mat-elevation-z8">

<ng-container matColumnDef="a">
<th mat-header-cell *matHeaderCellDef> A </th>
<td mat-cell *matCellDef="let cell"> {{cell.a}} </td>
</ng-container>

<ng-container matColumnDef="b">
<th mat-header-cell *matHeaderCellDef> B </th>
<td mat-cell *matCellDef="let cell"> {{cell.b}} </td>
</ng-container>

<ng-container matColumnDef="c">
<th mat-header-cell *matHeaderCellDef> C </th>
<td mat-cell *matCellDef="let cell"> {{cell.c}} </td>
</ng-container>

<ng-container matColumnDef="d">
<th mat-header-cell *matHeaderCellDef> D </th>
<td mat-cell *matCellDef="let cell"> {{cell.d}} </td>
</ng-container>

<ng-container matColumnDef="e">
<th mat-header-cell *matHeaderCellDef> E </th>
<td mat-cell *matCellDef="let cell"> {{cell.e}} </td>
</ng-container>

<ng-container matColumnDef="f">
<th mat-header-cell *matHeaderCellDef> F </th>
<td mat-cell *matCellDef="let cell"> {{cell.f}} </td>
</ng-container>

<ng-container matColumnDef="g">
<th mat-header-cell *matHeaderCellDef> G </th>
<td mat-cell *matCellDef="let cell"> {{cell.g}} </td>
</ng-container>

<ng-container matColumnDef="h">
<th mat-header-cell *matHeaderCellDef> H </th>
<td mat-cell *matCellDef="let cell"> {{cell.h}} </td>
</ng-container>

<ng-container matColumnDef="i">
<th mat-header-cell *matHeaderCellDef> I </th>
<td mat-cell *matCellDef="let cell"> {{cell.i}} </td>
</ng-container>

<ng-container matColumnDef="j">
<th mat-header-cell *matHeaderCellDef> J </th>
<td mat-cell *matCellDef="let cell"> {{cell.j}} </td>
</ng-container>

<ng-container matColumnDef="k">
<th mat-header-cell *matHeaderCellDef> K </th>
<td mat-cell *matCellDef="let cell"> {{cell.k}} </td>
</ng-container>

<ng-container matColumnDef="l">
<th mat-header-cell *matHeaderCellDef> L </th>
<td mat-cell *matCellDef="let cell"> {{cell.l}} </td>
</ng-container>

<ng-container matColumnDef="m">
<th mat-header-cell *matHeaderCellDef> M </th>
<td mat-cell *matCellDef="let cell"> {{cell.m}} </td>
</ng-container>

<ng-container matColumnDef="n">
<th mat-header-cell *matHeaderCellDef> N </th>
<td mat-cell *matCellDef="let cell"> {{cell.n}} </td>
</ng-container>

<ng-container matColumnDef="o">
<th mat-header-cell *matHeaderCellDef> O </th>
<td mat-cell *matCellDef="let cell"> {{cell.o}} </td>
</ng-container>

<ng-container matColumnDef="p">
<th mat-header-cell *matHeaderCellDef> P </th>
<td mat-cell *matCellDef="let cell"> {{cell.p}} </td>
</ng-container>

<ng-container matColumnDef="q">
<th mat-header-cell *matHeaderCellDef> Q </th>
<td mat-cell *matCellDef="let cell"> {{cell.q}} </td>
</ng-container>

<ng-container matColumnDef="r">
<th mat-header-cell *matHeaderCellDef> R </th>
<td mat-cell *matCellDef="let cell"> {{cell.r}} </td>
</ng-container>

<ng-container matColumnDef="s">
<th mat-header-cell *matHeaderCellDef> S </th>
<td mat-cell *matCellDef="let cell"> {{cell.s}} </td>
</ng-container>

<ng-container matColumnDef="t">
<th mat-header-cell *matHeaderCellDef> T </th>
<td mat-cell *matCellDef="let cell"> {{cell.t}} </td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="cols"></tr>
<tr mat-row *matRowDef="let row; columns: cols;"></tr>
</table>
`,
templateUrl: './basic-table.html',
styles: ['table { width: 100% }', 'th.mat-header-cell, td.mat-cell { padding: 0px 20px }'],
})
export class BasicTable {
Expand Down
13 changes: 13 additions & 0 deletions test/benchmarks/material/table/table-app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<button id="hide" (click)="hide()">Hide</button>
<button id="show-10-rows-5-cols" (click)="showTenRowsFiveCols()">Show 10 Rows 5 Cols</button>
<button id="show-100-rows-5-cols" (click)="showOneHundredRowsFiveCols()">Show 100 Rows 5 Cols</button>
<button id="show-1000-rows-5-cols" (click)="showOneThousandRowsFiveCols()">Show 1000 Rows 5 Cols</button>
<button id="show-10-rows-10-cols" (click)="showTenRowsTenCols()">Show 10 Rows 10 Cols</button>
<button id="show-10-rows-20-cols" (click)="showTenRowsTwentyCols()">Show 10 Rows 20 Cols</button>

<basic-table [rows]="tenRows" [cols]="fiveCols" *ngIf="isTenRowsFiveColsVisible"></basic-table>
<basic-table [rows]="oneHundredRows" [cols]="fiveCols" *ngIf="isOneHundredRowsFiveColsVisible"></basic-table>
<basic-table [rows]="oneThousandRows" [cols]="fiveCols" *ngIf="isOneThousandRowsFiveColsVisible"></basic-table>

<basic-table [rows]="tenRows" [cols]="tenCols" *ngIf="isTenRowsTenColsVisible"></basic-table>
<basic-table [rows]="tenRows" [cols]="twentyCols" *ngIf="isTenRowsTwentyColsVisible"></basic-table>