Skip to content

Commit 09d034b

Browse files
amysortommalerba
authored andcommitted
build: add input example to mdc-migration integration test
1 parent 56c8a5f commit 09d034b

File tree

14 files changed

+121
-0
lines changed

14 files changed

+121
-0
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
@@ -1,4 +1,5 @@
11
<chips-example></chips-example>
2+
<input-example></input-example>
23
<menu-example></menu-example>
34
<paginator-example></paginator-example>
45
<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
@@ -6,11 +6,13 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
66
import {MatChipsModule} from '@angular/material-experimental/mdc-chips';
77
import {MatFormFieldModule} from '@angular/material-experimental/mdc-form-field';
88
import {MatIconModule} from '@angular/material/icon';
9+
import {MatInputModule} from '@angular/material-experimental/mdc-input';
910
import {MatMenuModule} from '@angular/material-experimental/mdc-menu';
1011
import {MatPaginatorModule} from '@angular/material-experimental/mdc-paginator';
1112
import {MatProgressBarModule} from '@angular/material-experimental/mdc-progress-bar';
1213
import {MatProgressSpinnerModule} from '@angular/material-experimental/mdc-progress-spinner';
1314
import {ChipsComponent} from './components/chips/chips.component';
15+
import {InputComponent} from './components/input/input.component';
1416
import {MenuComponent} from './components/menu/menu.component';
1517
import {PaginatorComponent} from './components/paginator/paginator.component';
1618
import {ProgressSpinnerComponent} from './components/progress-spinner/progress-spinner.component';
@@ -20,6 +22,7 @@ import {ProgressBarComponent} from './components/progress-bar/progress-bar.compo
2022
declarations: [
2123
AppComponent,
2224
ChipsComponent,
25+
InputComponent,
2326
MenuComponent,
2427
PaginatorComponent,
2528
ProgressBarComponent,
@@ -31,6 +34,7 @@ import {ProgressBarComponent} from './components/progress-bar/progress-bar.compo
3134
MatChipsModule,
3235
MatFormFieldModule,
3336
MatIconModule,
37+
MatInputModule,
3438
MatMenuModule,
3539
MatPaginatorModule,
3640
MatProgressBarModule,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<h2>Input example</h2>
2+
<form class="example-form">
3+
<mat-form-field appearance="fill">
4+
<mat-label>Favorite food</mat-label>
5+
<input matInput placeholder="Ex. Pizza" value="Sushi">
6+
</mat-form-field>
7+
</form>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.example-form .mat-mdc-input-element {
2+
color: midnightblue;
3+
}
4+
5+
6+
/* TODO: The following rule targets internal classes of input that may no longer apply for the MDC version. */
7+
8+
.mat-input-server {
9+
color: red;
10+
}
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 {MatInputModule} from '@angular/material/input';
4+
import {InputComponent} from './input.component';
5+
6+
describe('InputComponent', () => {
7+
let component: InputComponent;
8+
let fixture: ComponentFixture<InputComponent>;
9+
10+
beforeEach(async () => {
11+
await TestBed.configureTestingModule({
12+
imports: [BrowserAnimationsModule, MatInputModule],
13+
declarations: [InputComponent],
14+
}).compileComponents();
15+
});
16+
17+
beforeEach(() => {
18+
fixture = TestBed.createComponent(InputComponent);
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: 'input-example',
5+
templateUrl: './input.component.html',
6+
styleUrls: ['./input.component.scss'],
7+
})
8+
export class InputComponent implements OnInit {
9+
constructor() {}
10+
11+
ngOnInit(): void {}
12+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ $sample-project-theme: mat.define-light-theme((
3232
@include mat.mdc-chips-typography($sample-project-theme);
3333
@include mat.mdc-menu-theme($sample-project-theme);
3434
@include mat.mdc-menu-typography($sample-project-theme);
35+
@include mat.mdc-input-theme($sample-project-theme);
36+
@include mat.mdc-input-typography($sample-project-theme);
3537
@include mat.mdc-paginator-theme($sample-project-theme);
3638
@include mat.mdc-paginator-typography($sample-project-theme);
3739
@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
@@ -1,4 +1,5 @@
11
<chips-example></chips-example>
2+
<input-example></input-example>
23
<menu-example></menu-example>
34
<paginator-example></paginator-example>
45
<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
@@ -6,11 +6,13 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
66
import {MatChipsModule} from '@angular/material/chips';
77
import {MatFormFieldModule} from '@angular/material/form-field';
88
import {MatIconModule} from '@angular/material/icon';
9+
import {MatInputModule} from '@angular/material/input';
910
import {MatMenuModule} from '@angular/material/menu';
1011
import {MatPaginatorModule} from '@angular/material/paginator';
1112
import {MatProgressBarModule} from '@angular/material/progress-bar';
1213
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
1314
import {ChipsComponent} from './components/chips/chips.component';
15+
import {InputComponent} from './components/input/input.component';
1416
import {MenuComponent} from './components/menu/menu.component';
1517
import {PaginatorComponent} from './components/paginator/paginator.component';
1618
import {ProgressSpinnerComponent} from './components/progress-spinner/progress-spinner.component';
@@ -20,6 +22,7 @@ import {ProgressBarComponent} from './components/progress-bar/progress-bar.compo
2022
declarations: [
2123
AppComponent,
2224
ChipsComponent,
25+
InputComponent,
2326
MenuComponent,
2427
PaginatorComponent,
2528
ProgressBarComponent,
@@ -31,6 +34,7 @@ import {ProgressBarComponent} from './components/progress-bar/progress-bar.compo
3134
MatChipsModule,
3235
MatFormFieldModule,
3336
MatIconModule,
37+
MatInputModule,
3438
MatMenuModule,
3539
MatPaginatorModule,
3640
MatProgressBarModule,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<h2>Input example</h2>
2+
<form class="example-form">
3+
<mat-form-field appearance="fill">
4+
<mat-label>Favorite food</mat-label>
5+
<input matInput placeholder="Ex. Pizza" value="Sushi">
6+
</mat-form-field>
7+
</form>

0 commit comments

Comments
 (0)