Skip to content

Commit 8735aa5

Browse files
committed
chore: enforce consistency in demo-app
1 parent b057391 commit 8735aa5

File tree

137 files changed

+584
-558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+584
-558
lines changed

src/demo-app/a11y/a11y-module.ts

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

9-
import {NgModule} from '@angular/core';
109
import {CommonModule} from '@angular/common';
10+
import {NgModule} from '@angular/core';
1111
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
1212
import {RouterModule} from '@angular/router';
13-
import {ACCESSIBILITY_DEMO_ROUTES} from './routes';
1413
import {DemoMaterialModule} from '../demo-material-module';
1514
import {AccessibilityDemo, AccessibilityHome} from './a11y';
1615
import {AutocompleteAccessibilityDemo} from './autocomplete/autocomplete-a11y';
17-
import {ButtonAccessibilityDemo} from './button/button-a11y';
1816
import {ButtonToggleAccessibilityDemo} from './button-toggle/button-toggle-a11y';
17+
import {ButtonAccessibilityDemo} from './button/button-a11y';
1918
import {CardAccessibilityDemo} from './card/card-a11y';
2019
import {CheckboxAccessibilityDemo} from './checkbox/checkbox-a11y';
2120
import {ChipsAccessibilityDemo} from './chips/chips-a11y';
21+
import {DatepickerAccessibilityDemo} from './datepicker/datepicker-a11y';
2222
import {
2323
DialogAccessibilityDemo,
2424
DialogAddressFormDialog,
@@ -29,31 +29,32 @@ import {
2929
} from './dialog/dialog-a11y';
3030
import {ExpansionPanelAccessibilityDemo} from './expansion/expansion-a11y';
3131
import {GridListAccessibilityDemo} from './grid-list/grid-list-a11y';
32-
import {ListAccessibilityDemo} from './list/list-a11y';
33-
import {RadioAccessibilityDemo} from './radio/radio-a11y';
34-
import {ToolbarAccessibilityDemo} from './toolbar/toolbar-a11y';
35-
import {DatepickerAccessibilityDemo} from './datepicker/datepicker-a11y';
3632
import {IconAccessibilityDemo} from './icon/icon-a11y';
3733
import {InputAccessibilityDemo} from './input/input-a11y';
34+
import {ListAccessibilityDemo} from './list/list-a11y';
3835
import {MenuAccessibilityDemo} from './menu/menu-a11y';
3936
import {ProgressBarAccessibilityDemo} from './progress-bar/progress-bar-a11y';
4037
import {ProgressSpinnerAccessibilityDemo} from './progress-spinner/progress-spinner-a11y';
41-
import {SliderAccessibilityDemo} from './slider/slider-a11y';
38+
import {RadioAccessibilityDemo} from './radio/radio-a11y';
39+
import {ACCESSIBILITY_DEMO_ROUTES} from './routes';
40+
import {SelectAccessibilityDemo} from './select/select-a11y';
41+
import {SidenavBasicAccessibilityDemo} from './sidenav/basic-sidenav-a11y';
42+
import {SidenavDualAccessibilityDemo} from './sidenav/dual-sidenav-a11y';
43+
import {SidenavMobileAccessibilityDemo} from './sidenav/mobile-sidenav-a11y';
44+
import {SidenavAccessibilityDemo} from './sidenav/sidenav-a11y';
4245
import {SlideToggleAccessibilityDemo} from './slide-toggle/slide-toggle-a11y';
46+
import {SliderAccessibilityDemo} from './slider/slider-a11y';
4347
import {SnackBarAccessibilityDemo} from './snack-bar/snack-bar-a11y';
44-
import {SelectAccessibilityDemo} from './select/select-a11y';
4548
import {TableAccessibilityDemo} from './table/table-a11y';
4649
import {
47-
TabsAccessibilityDemo,
48-
SunnyTabContent,
49-
RainyTabContent,
5050
FoggyTabContent,
51+
RainyTabContent,
52+
SunnyTabContent,
53+
TabsAccessibilityDemo,
5154
} from './tabs/tabs-a11y';
55+
import {ToolbarAccessibilityDemo} from './toolbar/toolbar-a11y';
5256
import {TooltipAccessibilityDemo} from './tooltip/tooltip-a11y';
53-
import {SidenavAccessibilityDemo} from './sidenav/sidenav-a11y';
54-
import {SidenavBasicAccessibilityDemo} from './sidenav/basic-sidenav-a11y';
55-
import {SidenavDualAccessibilityDemo} from './sidenav/dual-sidenav-a11y';
56-
import {SidenavMobileAccessibilityDemo} from './sidenav/mobile-sidenav-a11y';
57+
5758

5859
@NgModule({
5960
imports: [
@@ -105,11 +106,11 @@ export class AccessibilityRoutingModule {}
105106
SidenavBasicAccessibilityDemo,
106107
SidenavDualAccessibilityDemo,
107108
SidenavMobileAccessibilityDemo,
108-
SliderAccessibilityDemo,
109109
SlideToggleAccessibilityDemo,
110+
SliderAccessibilityDemo,
110111
SnackBarAccessibilityDemo,
111-
TableAccessibilityDemo,
112112
SunnyTabContent,
113+
TableAccessibilityDemo,
113114
TabsAccessibilityDemo,
114115
ToolbarAccessibilityDemo,
115116
TooltipAccessibilityDemo,

src/demo-app/a11y/a11y.ts

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

9-
import {Component, ElementRef, OnDestroy, ViewChild, ViewEncapsulation} from '@angular/core';
9+
import {Component, ElementRef, OnDestroy, ViewChild} from '@angular/core';
1010
import {NavigationEnd, Router} from '@angular/router';
1111
import {Subscription} from 'rxjs';
1212

13+
1314
@Component({
1415
moduleId: module.id,
1516
selector: 'accessibility-home',
@@ -22,10 +23,9 @@ export class AccessibilityHome {}
2223
selector: 'accessibility-demo',
2324
templateUrl: 'a11y.html',
2425
styleUrls: ['a11y.css'],
25-
encapsulation: ViewEncapsulation.None,
2626
})
2727
export class AccessibilityDemo implements OnDestroy {
28-
currentComponent: string = '';
28+
currentComponent = '';
2929

3030
fullscreen = false;
3131

@@ -67,8 +67,8 @@ export class AccessibilityDemo implements OnDestroy {
6767
constructor(router: Router) {
6868
this._routerSubscription = router.events.subscribe((e) => {
6969
if (e instanceof NavigationEnd) {
70-
let fragments = e.url.split('/');
71-
let nav = this.navItems.find(navItem => {
70+
const fragments = e.url.split('/');
71+
const nav = this.navItems.find(navItem => {
7272
return fragments[fragments.length - 1] === navItem.route;
7373
});
7474
this.currentComponent = nav ? nav.name : '';

src/demo-app/a11y/button/button-a11y.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import {Component} from '@angular/core';
1010
import {MatSnackBar} from '@angular/material';
1111

12+
1213
@Component({
1314
moduleId: module.id,
1415
selector: 'button-a11y',

src/demo-app/a11y/card/card-a11y.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<section>
22
<h2>Dogs group</h2>
33
<p>Showing a card with a group of content.</p>
4-
<mat-card class="example-card" role="group">
4+
<mat-card class="demo-card" role="group">
55
<mat-card-content>
66
<p>Herding Group</p>
77
<p>Hound Group</p>
@@ -19,15 +19,15 @@ <h2>Dogs group</h2>
1919
<section>
2020
<h2>Husky</h2>
2121
<p>Showing a card with title only.</p>
22-
<mat-card class="example-card">
22+
<mat-card class="demo-card">
2323
Siberian Husky
2424
</mat-card>
2525
</section>
2626

2727
<section>
2828
<h2>Malamute</h2>
2929
<p>Showing a Card with title and subtitle.</p>
30-
<mat-card class="example-card">
30+
<mat-card class="demo-card">
3131
<mat-card-title>Alaskan Malamute</mat-card-title>
3232
<mat-card-subtitle>Dog breed</mat-card-subtitle>
3333
</mat-card>
@@ -37,7 +37,7 @@ <h2>Malamute</h2>
3737
<section>
3838
<h2>German Shepherd</h2>
3939
<p>Showing a card with title, subtitle, and a footer.</p>
40-
<mat-card class="example-card">
40+
<mat-card class="demo-card">
4141
<mat-card-subtitle>Dog breed</mat-card-subtitle>
4242
<mat-card-title>German Shepherd</mat-card-title>
4343
<mat-card-content>
@@ -54,7 +54,7 @@ <h2>German Shepherd</h2>
5454
<section>
5555
<h2>Dachshund</h2>
5656
<p>Showing a card with title, subtitle, and avatar as header and a card image.</p>
57-
<mat-card class="example-card">
57+
<mat-card class="demo-card">
5858
<mat-card-header>
5959
<img mat-card-avatar src="a11y/card/assets/dachshund-avatar.jpg" aria-label="Dachshund avatar">
6060
<mat-card-title>Dachshund</mat-card-title>
@@ -71,7 +71,7 @@ <h2>Dachshund</h2>
7171
<section>
7272
<h2>Shiba Inu</h2>
7373
<p>Showing a card with header, content, image, and two action buttons: "share" and "like".</p>
74-
<mat-card class="example-card">
74+
<mat-card class="demo-card">
7575
<mat-card-header>
7676
<img mat-card-avatar src="a11y/card/assets/shiba-inu-avatar.jpg" aria-label="Shiba Inu avatar">
7777
<mat-card-title>Shiba Inu</mat-card-title>

src/demo-app/a11y/card/card-a11y.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
.example-card button {
1+
.demo-card button {
22
text-transform: uppercase;
33
}
44

5-
.example-card {
5+
.demo-card {
66
max-width: 450px;
77
}

src/demo-app/a11y/card/card-a11y.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import {Component} from '@angular/core';
1010
import {MatSnackBar} from '@angular/material';
1111

12+
1213
@Component({
1314
moduleId: module.id,
1415
selector: 'card-a11y',

src/demo-app/a11y/checkbox/checkbox-a11y.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ <h2>Nested checklist</h2>
2424
(change)="setAllCompleted(task.subtasks, $event.checked)">
2525
{{task.name}}
2626
</mat-checkbox>
27-
<div class="sub-list">
27+
<div class="demo-sub-list">
2828
<div *ngFor="let subtask of task.subtasks">
2929
<mat-checkbox [(ngModel)]="subtask.completed">
3030
{{subtask.name}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
.sub-list {
1+
.demo-sub-list {
22
margin-left: 20px;
33
}

src/demo-app/a11y/checkbox/checkbox-a11y.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import {Component} from '@angular/core';
1010

11+
1112
export interface Task {
1213
name: string;
1314
completed: boolean;
@@ -27,30 +28,26 @@ export class CheckboxAccessibilityDemo {
2728
name: 'Reminders',
2829
completed: false,
2930
subtasks: [
30-
{ name: 'Cook Dinner', completed: false },
31-
{ name: 'Read the Material Design Spec', completed: false },
32-
{ name: 'Upgrade Application to Angular', completed: false }
31+
{name: 'Cook Dinner', completed: false},
32+
{name: 'Read the Material Design Spec', completed: false},
33+
{name: 'Upgrade Application to Angular', completed: false}
3334
]
3435
},
3536
{
3637
name: 'Groceries',
3738
completed: false,
3839
subtasks: [
39-
{ name: 'Organic Eggs', completed: false },
40-
{ name: 'Protein Powder', completed: false },
41-
{ name: 'Almond Meal Flour', completed: false }
40+
{name: 'Organic Eggs', completed: false},
41+
{name: 'Protein Powder', completed: false},
42+
{name: 'Almond Meal Flour', completed: false}
4243
]
4344
}
4445
];
4546

4647
allComplete(task: Task): boolean {
47-
let subtasks = task.subtasks;
48-
49-
if (!subtasks) {
50-
return false;
51-
}
48+
const subtasks = task.subtasks;
5249

53-
return subtasks.every(t => t.completed);
50+
return task.completed || (subtasks != null && subtasks.every(t => t.completed));
5451
}
5552

5653
someComplete(tasks: Task[]): boolean {

src/demo-app/a11y/chips/chips-a11y.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ export class ChipsAccessibilityDemo {
2929
message: string = '';
3030

3131
people: Person[] = [
32-
{ name: 'Kara' },
33-
{ name: 'Jeremy' },
34-
{ name: 'Topher' },
35-
{ name: 'Elad' },
36-
{ name: 'Kristiyan' },
37-
{ name: 'Paul' }
32+
{name: 'Kara'},
33+
{name: 'Jeremy'},
34+
{name: 'Topher'},
35+
{name: 'Elad'},
36+
{name: 'Kristiyan'},
37+
{name: 'Paul'}
3838
];
3939

4040
availableColors = [
41-
{ name: 'none', color: '' },
42-
{ name: 'Primary', color: 'primary' },
43-
{ name: 'Accent', color: 'accent' },
44-
{ name: 'Warn', color: 'warn' }
41+
{name: 'none', color: ''},
42+
{name: 'Primary', color: 'primary'},
43+
{name: 'Accent', color: 'accent'},
44+
{name: 'Warn', color: 'warn'}
4545
];
4646

4747
constructor(public snackBar: MatSnackBar) {}
@@ -51,8 +51,8 @@ export class ChipsAccessibilityDemo {
5151
}
5252

5353
add(event: MatChipInputEvent): void {
54-
let input = event.input;
55-
let value = event.value;
54+
const input = event.input;
55+
const value = event.value;
5656

5757
// Add our person
5858
if ((value || '').trim()) {
@@ -69,7 +69,7 @@ export class ChipsAccessibilityDemo {
6969
}
7070

7171
remove(person: Person): void {
72-
let index = this.people.indexOf(person);
72+
const index = this.people.indexOf(person);
7373

7474
if (index >= 0) {
7575
this.people.splice(index, 1);
@@ -80,6 +80,4 @@ export class ChipsAccessibilityDemo {
8080
toggleVisible(): void {
8181
this.visible = false;
8282
}
83-
84-
8583
}

src/demo-app/a11y/datepicker/datepicker-a11y.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import {Component} from '@angular/core';
1010

11+
1112
@Component({
1213
moduleId: module.id,
1314
selector: 'datepicker-a11y',

src/demo-app/a11y/dialog/dialog-a11y.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import {MatDialog} from '@angular/material';
1717
styleUrls: ['dialog-a11y.css'],
1818
})
1919
export class DialogAccessibilityDemo {
20-
fruitSelectedOption: string = '';
20+
fruitSelectedOption = '';
2121

2222
constructor(public dialog: MatDialog) {}
2323

2424
openFruitDialog() {
25-
let dialogRef = this.dialog.open(DialogFruitExampleDialog);
25+
const dialogRef = this.dialog.open(DialogFruitExampleDialog);
2626
dialogRef.afterClosed().subscribe(result => {
2727
this.fruitSelectedOption = result;
2828
});
@@ -44,21 +44,21 @@ export class DialogAccessibilityDemo {
4444
@Component({
4545
moduleId: module.id,
4646
selector: 'dialog-fruit-a11y',
47-
templateUrl: 'dialog-fruit-a11y.html'
47+
templateUrl: 'dialog-fruit-a11y.html',
4848
})
4949
export class DialogFruitExampleDialog {}
5050

5151
@Component({
5252
moduleId: module.id,
5353
selector: 'dialog-welcome-a11y',
54-
templateUrl: 'dialog-welcome-a11y.html'
54+
templateUrl: 'dialog-welcome-a11y.html',
5555
})
5656
export class DialogWelcomeExampleDialog {}
5757

5858
@Component({
5959
moduleId: module.id,
6060
selector: 'dialog-neptune-a11y-dialog',
61-
templateUrl: './dialog-neptune-a11y.html'
61+
templateUrl: './dialog-neptune-a11y.html',
6262
})
6363
export class DialogNeptuneExampleDialog {
6464
constructor(public dialog: MatDialog) { }
@@ -71,18 +71,23 @@ export class DialogNeptuneExampleDialog {
7171
@Component({
7272
moduleId: module.id,
7373
selector: 'dialog-neptune-iframe-dialog',
74-
styles: [
75-
`iframe {
74+
styles: [`
75+
iframe {
7676
width: 800px;
77-
}`
78-
],
79-
templateUrl: './dialog-neptune-iframe-a11y.html'
77+
}
78+
`],
79+
templateUrl: './dialog-neptune-iframe-a11y.html',
8080
})
8181
export class DialogNeptuneIFrameDialog {}
8282

8383
@Component({
8484
moduleId: module.id,
8585
selector: 'dialog-address-form-a11y',
86-
templateUrl: 'dialog-address-form-a11y.html'
86+
styles: [`
87+
.demo-full-width {
88+
width: 100%;
89+
}
90+
`],
91+
templateUrl: 'dialog-address-form-a11y.html',
8792
})
8893
export class DialogAddressFormDialog {}

0 commit comments

Comments
 (0)