Skip to content

Commit 62607c2

Browse files
amysortommalerba
authored andcommitted
build: add list example to mdc-migration integration test
1 parent 4f9cef4 commit 62607c2

File tree

14 files changed

+142
-3
lines changed

14 files changed

+142
-3
lines changed

integration/mdc-migration/golden/src/app/app.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<chips-example></chips-example>
55
<form-field-example></form-field-example>
66
<input-example></input-example>
7+
<list-example></list-example>
78
<menu-example></menu-example>
89
<paginator-example></paginator-example>
910
<progress-bar-example></progress-bar-example>

integration/mdc-migration/golden/src/app/app.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {MatChipsModule} from '@angular/material-experimental/mdc-chips';
1111
import {MatFormFieldModule} from '@angular/material-experimental/mdc-form-field';
1212
import {MatIconModule} from '@angular/material/icon';
1313
import {MatInputModule} from '@angular/material-experimental/mdc-input';
14+
import {MatListModule} from '@angular/material-experimental/mdc-list';
1415
import {MatMenuModule} from '@angular/material-experimental/mdc-menu';
1516
import {MatPaginatorModule} from '@angular/material-experimental/mdc-paginator';
1617
import {MatProgressBarModule} from '@angular/material-experimental/mdc-progress-bar';
@@ -21,6 +22,7 @@ import {CardComponent} from './components/card/card.component';
2122
import {ChipsComponent} from './components/chips/chips.component';
2223
import {FormFieldComponent} from './components/form-field/form-field.component';
2324
import {InputComponent} from './components/input/input.component';
25+
import {ListComponent} from './components/list/list.component';
2426
import {MenuComponent} from './components/menu/menu.component';
2527
import {PaginatorComponent} from './components/paginator/paginator.component';
2628
import {ProgressSpinnerComponent} from './components/progress-spinner/progress-spinner.component';
@@ -37,6 +39,7 @@ import {ButtonComponent} from './components/button/button.component';
3739
ChipsComponent,
3840
FormFieldComponent,
3941
InputComponent,
42+
ListComponent,
4043
MenuComponent,
4144
PaginatorComponent,
4245
ProgressBarComponent,
@@ -53,6 +56,7 @@ import {ButtonComponent} from './components/button/button.component';
5356
MatFormFieldModule,
5457
MatIconModule,
5558
MatInputModule,
59+
MatListModule,
5660
MatMenuModule,
5761
MatPaginatorModule,
5862
MatProgressBarModule,
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<h2>List example</h2>
2+
<mat-list role="list">
3+
<mat-list-item role="listitem">
4+
<mat-icon mat-list-icon>account_circle</mat-icon>
5+
<div mat-line>Account Information</div>
6+
</mat-list-item>
7+
<mat-list-item role="listitem">
8+
<mat-icon mat-list-icon>settings</mat-icon>
9+
<div mat-line>Settings</div>
10+
</mat-list-item>
11+
<mat-list-item role="listitem">
12+
<mat-icon mat-list-icon>logout</mat-icon>
13+
<div mat-line>Log Out</div>
14+
</mat-list-item>
15+
</mat-list>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.mat-mdc-list { padding: 8px; }
2+
3+
.mat-mdc-list-item-icon {
4+
color: darkblue;
5+
}
6+
7+
/* TODO: The following rule targets internal classes of list that may no longer apply for the MDC version. */
8+
9+
.mat-list-item-content {
10+
padding: 8px;
11+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {ComponentFixture, TestBed} from '@angular/core/testing';
2+
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
3+
import {MatListModule} from '@angular/material/list';
4+
import {ListComponent} from './list.component';
5+
6+
describe('ListComponent', () => {
7+
let component: ListComponent;
8+
let fixture: ComponentFixture<ListComponent>;
9+
10+
beforeEach(async () => {
11+
await TestBed.configureTestingModule({
12+
imports: [BrowserAnimationsModule, MatListModule],
13+
declarations: [ListComponent],
14+
}).compileComponents();
15+
});
16+
17+
beforeEach(() => {
18+
fixture = TestBed.createComponent(ListComponent);
19+
component = fixture.componentInstance;
20+
fixture.detectChanges();
21+
});
22+
23+
it('should create', () => {
24+
expect(component).toBeTruthy();
25+
});
26+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import {Component, OnInit} from '@angular/core';
2+
3+
@Component({
4+
selector: 'list-example',
5+
templateUrl: './list.component.html',
6+
styleUrls: ['./list.component.scss'],
7+
})
8+
export class ListComponent implements OnInit {
9+
constructor() {}
10+
11+
ngOnInit(): void {}
12+
}

integration/mdc-migration/golden/src/styles.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ $sample-project-theme: mat.define-light-theme((
4242
@include mat.mdc-chips-typography($sample-project-theme);
4343
@include mat.mdc-form-field-theme($sample-project-theme);
4444
@include mat.mdc-form-field-typography($sample-project-theme);
45-
@include mat.mdc-menu-theme($sample-project-theme);
46-
@include mat.mdc-menu-typography($sample-project-theme);
4745
@include mat.mdc-input-theme($sample-project-theme);
4846
@include mat.mdc-input-typography($sample-project-theme);
47+
@include mat.mdc-list-theme($sample-project-theme);
48+
@include mat.mdc-list-typography($sample-project-theme);
49+
@include mat.mdc-menu-theme($sample-project-theme);
50+
@include mat.mdc-menu-typography($sample-project-theme);
4951
@include mat.mdc-paginator-theme($sample-project-theme);
5052
@include mat.mdc-paginator-typography($sample-project-theme);
5153
@include mat.mdc-progress-bar-theme($sample-project-theme);

integration/mdc-migration/sample-project/src/app/app.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<chips-example></chips-example>
55
<form-field-example></form-field-example>
66
<input-example></input-example>
7+
<list-example></list-example>
78
<menu-example></menu-example>
89
<paginator-example></paginator-example>
910
<progress-bar-example></progress-bar-example>

integration/mdc-migration/sample-project/src/app/app.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {MatChipsModule} from '@angular/material/chips';
1111
import {MatFormFieldModule} from '@angular/material/form-field';
1212
import {MatIconModule} from '@angular/material/icon';
1313
import {MatInputModule} from '@angular/material/input';
14+
import {MatListModule} from '@angular/material/list';
1415
import {MatMenuModule} from '@angular/material/menu';
1516
import {MatPaginatorModule} from '@angular/material/paginator';
1617
import {MatProgressBarModule} from '@angular/material/progress-bar';
@@ -21,6 +22,7 @@ import {CardComponent} from './components/card/card.component';
2122
import {ChipsComponent} from './components/chips/chips.component';
2223
import {FormFieldComponent} from './components/form-field/form-field.component';
2324
import {InputComponent} from './components/input/input.component';
25+
import {ListComponent} from './components/list/list.component';
2426
import {MenuComponent} from './components/menu/menu.component';
2527
import {PaginatorComponent} from './components/paginator/paginator.component';
2628
import {ProgressSpinnerComponent} from './components/progress-spinner/progress-spinner.component';
@@ -37,6 +39,7 @@ import {ButtonComponent} from './components/button/button.component';
3739
ChipsComponent,
3840
FormFieldComponent,
3941
InputComponent,
42+
ListComponent,
4043
MenuComponent,
4144
PaginatorComponent,
4245
ProgressBarComponent,
@@ -53,6 +56,7 @@ import {ButtonComponent} from './components/button/button.component';
5356
MatFormFieldModule,
5457
MatIconModule,
5558
MatInputModule,
59+
MatListModule,
5660
MatMenuModule,
5761
MatPaginatorModule,
5862
MatProgressBarModule,
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<h2>List example</h2>
2+
<mat-list role="list">
3+
<mat-list-item role="listitem">
4+
<mat-icon mat-list-icon>account_circle</mat-icon>
5+
<div mat-line>Account Information</div>
6+
</mat-list-item>
7+
<mat-list-item role="listitem">
8+
<mat-icon mat-list-icon>settings</mat-icon>
9+
<div mat-line>Settings</div>
10+
</mat-list-item>
11+
<mat-list-item role="listitem">
12+
<mat-icon mat-list-icon>logout</mat-icon>
13+
<div mat-line>Log Out</div>
14+
</mat-list-item>
15+
</mat-list>

0 commit comments

Comments
 (0)