Skip to content

Commit 868ee67

Browse files
amysortommalerba
authored andcommitted
build: add button example to mdc-migration integration test
1 parent 296e42d commit 868ee67

File tree

14 files changed

+111
-0
lines changed

14 files changed

+111
-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
<autocomplete-example></autocomplete-example>
2+
<button-example></button-example>
23
<chips-example></chips-example>
34
<form-field-example></form-field-example>
45
<input-example></input-example>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {AppComponent} from './app.component';
55
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
66
import {ReactiveFormsModule} from '@angular/forms';
77
import {MatAutocompleteModule} from '@angular/material-experimental/mdc-autocomplete';
8+
import {MatButtonModule} from '@angular/material-experimental/mdc-button';
89
import {MatChipsModule} from '@angular/material-experimental/mdc-chips';
910
import {MatFormFieldModule} from '@angular/material-experimental/mdc-form-field';
1011
import {MatIconModule} from '@angular/material/icon';
@@ -23,11 +24,13 @@ import {PaginatorComponent} from './components/paginator/paginator.component';
2324
import {ProgressSpinnerComponent} from './components/progress-spinner/progress-spinner.component';
2425
import {ProgressBarComponent} from './components/progress-bar/progress-bar.component';
2526
import {SelectComponent} from './components/select/select.component';
27+
import {ButtonComponent} from './components/button/button.component';
2628

2729
@NgModule({
2830
declarations: [
2931
AutocompleteComponent,
3032
AppComponent,
33+
ButtonComponent,
3134
ChipsComponent,
3235
FormFieldComponent,
3336
InputComponent,
@@ -41,6 +44,7 @@ import {SelectComponent} from './components/select/select.component';
4144
BrowserModule,
4245
BrowserAnimationsModule,
4346
MatAutocompleteModule,
47+
MatButtonModule,
4448
MatChipsModule,
4549
MatFormFieldModule,
4650
MatIconModule,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h2>Button example</h2>
2+
<button mat-button>Basic</button>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.mat-mdc-button {
2+
padding: 16px;
3+
}
4+
5+
6+
/* TODO: The following rule targets internal classes of button that may no longer apply for the MDC version. */
7+
8+
::ng-deep .mat-button-wrapper{ color: darkblue; }
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 {MatButtonModule} from '@angular/material/button';
4+
import {ButtonComponent} from './button.component';
5+
6+
describe('ButtonComponent', () => {
7+
let component: ButtonComponent;
8+
let fixture: ComponentFixture<ButtonComponent>;
9+
10+
beforeEach(async () => {
11+
await TestBed.configureTestingModule({
12+
imports: [BrowserAnimationsModule, MatButtonModule],
13+
declarations: [ButtonComponent],
14+
}).compileComponents();
15+
});
16+
17+
beforeEach(() => {
18+
fixture = TestBed.createComponent(ButtonComponent);
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: 'button-example',
5+
templateUrl: './button.component.html',
6+
styleUrls: ['./button.component.scss'],
7+
})
8+
export class ButtonComponent implements OnInit {
9+
constructor() {}
10+
11+
ngOnInit(): void {}
12+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ $sample-project-theme: mat.define-light-theme((
3030

3131
@include mat.mdc-autocomplete-theme($sample-project-theme);
3232
@include mat.mdc-autocomplete-typography($sample-project-theme);
33+
@include mat.mdc-button-theme($sample-project-theme);
34+
@include mat.mdc-button-typography($sample-project-theme);
35+
@include mat.mdc-fab-theme($sample-project-theme);
36+
@include mat.mdc-fab-typography($sample-project-theme);
37+
@include mat.mdc-icon-button-theme($sample-project-theme);
38+
@include mat.mdc-icon-button-typography($sample-project-theme);
3339
@include mat.mdc-chips-theme($sample-project-theme);
3440
@include mat.mdc-chips-typography($sample-project-theme);
3541
@include mat.mdc-form-field-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
<autocomplete-example></autocomplete-example>
2+
<button-example></button-example>
23
<chips-example></chips-example>
34
<form-field-example></form-field-example>
45
<input-example></input-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
@@ -5,6 +5,7 @@ import {AppComponent} from './app.component';
55
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
66
import {ReactiveFormsModule} from '@angular/forms';
77
import {MatAutocompleteModule} from '@angular/material/autocomplete';
8+
import {MatButtonModule} from '@angular/material/button';
89
import {MatChipsModule} from '@angular/material/chips';
910
import {MatFormFieldModule} from '@angular/material/form-field';
1011
import {MatIconModule} from '@angular/material/icon';
@@ -23,11 +24,13 @@ import {PaginatorComponent} from './components/paginator/paginator.component';
2324
import {ProgressSpinnerComponent} from './components/progress-spinner/progress-spinner.component';
2425
import {ProgressBarComponent} from './components/progress-bar/progress-bar.component';
2526
import {SelectComponent} from './components/select/select.component';
27+
import {ButtonComponent} from './components/button/button.component';
2628

2729
@NgModule({
2830
declarations: [
2931
AutocompleteComponent,
3032
AppComponent,
33+
ButtonComponent,
3134
ChipsComponent,
3235
FormFieldComponent,
3336
InputComponent,
@@ -41,6 +44,7 @@ import {SelectComponent} from './components/select/select.component';
4144
BrowserModule,
4245
BrowserAnimationsModule,
4346
MatAutocompleteModule,
47+
MatButtonModule,
4448
MatChipsModule,
4549
MatFormFieldModule,
4650
MatIconModule,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h2>Button example</h2>
2+
<button mat-button>Basic</button>

0 commit comments

Comments
 (0)