Skip to content

Commit ef4a360

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

File tree

14 files changed

+141
-0
lines changed

14 files changed

+141
-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,5 +1,6 @@
11
<autocomplete-example></autocomplete-example>
22
<button-example></button-example>
3+
<card-example></card-example>
34
<chips-example></chips-example>
45
<form-field-example></form-field-example>
56
<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
@@ -6,6 +6,7 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
66
import {ReactiveFormsModule} from '@angular/forms';
77
import {MatAutocompleteModule} from '@angular/material-experimental/mdc-autocomplete';
88
import {MatButtonModule} from '@angular/material-experimental/mdc-button';
9+
import {MatCardModule} from '@angular/material-experimental/mdc-card';
910
import {MatChipsModule} from '@angular/material-experimental/mdc-chips';
1011
import {MatFormFieldModule} from '@angular/material-experimental/mdc-form-field';
1112
import {MatIconModule} from '@angular/material/icon';
@@ -16,6 +17,7 @@ import {MatProgressBarModule} from '@angular/material-experimental/mdc-progress-
1617
import {MatProgressSpinnerModule} from '@angular/material-experimental/mdc-progress-spinner';
1718
import {MatSelectModule} from '@angular/material-experimental/mdc-select';
1819
import {AutocompleteComponent} from './components/autocomplete/autocomplete.component';
20+
import {CardComponent} from './components/card/card.component';
1921
import {ChipsComponent} from './components/chips/chips.component';
2022
import {FormFieldComponent} from './components/form-field/form-field.component';
2123
import {InputComponent} from './components/input/input.component';
@@ -31,6 +33,7 @@ import {ButtonComponent} from './components/button/button.component';
3133
AutocompleteComponent,
3234
AppComponent,
3335
ButtonComponent,
36+
CardComponent,
3437
ChipsComponent,
3538
FormFieldComponent,
3639
InputComponent,
@@ -45,6 +48,7 @@ import {ButtonComponent} from './components/button/button.component';
4548
BrowserAnimationsModule,
4649
MatAutocompleteModule,
4750
MatButtonModule,
51+
MatCardModule,
4852
MatChipsModule,
4953
MatFormFieldModule,
5054
MatIconModule,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<h2>Card example</h2>
2+
<mat-card appearance="outlined">Pomeranian</mat-card><mat-card appearance="outlined">Maltese</mat-card>
3+
<mat-card appearance="outlined">Chihuahua</mat-card>
4+
<mat-card appearance="outlined">
5+
Welsh Corgi
6+
<mat-card
7+
appearance="outlined"
8+
class="example-card">
9+
Cardigan Welsh Corgi
10+
</mat-card>
11+
<mat-card
12+
appearance="outlined"
13+
class="example-card">
14+
Pembroke Welsh Corgi
15+
</mat-card>
16+
</mat-card>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.example-card { color: gray; }
2+
3+
4+
.mat-mdc-card .example-card {
5+
padding-left: 24px;
6+
}
7+
8+
/* TODO: The following rule targets internal classes of card that may no longer apply for the MDC version. */
9+
10+
.mat-card-flat {
11+
margin: 4px;
12+
}
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 {MatCardModule} from '@angular/material/card';
4+
import {CardComponent} from './card.component';
5+
6+
describe('CardComponent', () => {
7+
let component: CardComponent;
8+
let fixture: ComponentFixture<CardComponent>;
9+
10+
beforeEach(async () => {
11+
await TestBed.configureTestingModule({
12+
imports: [BrowserAnimationsModule, MatCardModule],
13+
declarations: [CardComponent],
14+
}).compileComponents();
15+
});
16+
17+
beforeEach(() => {
18+
fixture = TestBed.createComponent(CardComponent);
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: 'card-example',
5+
templateUrl: './card.component.html',
6+
styleUrls: ['./card.component.scss'],
7+
})
8+
export class CardComponent 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
@@ -36,6 +36,8 @@ $sample-project-theme: mat.define-light-theme((
3636
@include mat.mdc-fab-typography($sample-project-theme);
3737
@include mat.mdc-icon-button-theme($sample-project-theme);
3838
@include mat.mdc-icon-button-typography($sample-project-theme);
39+
@include mat.mdc-card-theme($sample-project-theme);
40+
@include mat.mdc-card-typography($sample-project-theme);
3941
@include mat.mdc-chips-theme($sample-project-theme);
4042
@include mat.mdc-chips-typography($sample-project-theme);
4143
@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,5 +1,6 @@
11
<autocomplete-example></autocomplete-example>
22
<button-example></button-example>
3+
<card-example></card-example>
34
<chips-example></chips-example>
45
<form-field-example></form-field-example>
56
<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
@@ -6,6 +6,7 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
66
import {ReactiveFormsModule} from '@angular/forms';
77
import {MatAutocompleteModule} from '@angular/material/autocomplete';
88
import {MatButtonModule} from '@angular/material/button';
9+
import {MatCardModule} from '@angular/material/card';
910
import {MatChipsModule} from '@angular/material/chips';
1011
import {MatFormFieldModule} from '@angular/material/form-field';
1112
import {MatIconModule} from '@angular/material/icon';
@@ -16,6 +17,7 @@ import {MatProgressBarModule} from '@angular/material/progress-bar';
1617
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
1718
import {MatSelectModule} from '@angular/material/select';
1819
import {AutocompleteComponent} from './components/autocomplete/autocomplete.component';
20+
import {CardComponent} from './components/card/card.component';
1921
import {ChipsComponent} from './components/chips/chips.component';
2022
import {FormFieldComponent} from './components/form-field/form-field.component';
2123
import {InputComponent} from './components/input/input.component';
@@ -31,6 +33,7 @@ import {ButtonComponent} from './components/button/button.component';
3133
AutocompleteComponent,
3234
AppComponent,
3335
ButtonComponent,
36+
CardComponent,
3437
ChipsComponent,
3538
FormFieldComponent,
3639
InputComponent,
@@ -45,6 +48,7 @@ import {ButtonComponent} from './components/button/button.component';
4548
BrowserAnimationsModule,
4649
MatAutocompleteModule,
4750
MatButtonModule,
51+
MatCardModule,
4852
MatChipsModule,
4953
MatFormFieldModule,
5054
MatIconModule,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<h2>Card example</h2>
2+
<mat-card>Pomeranian</mat-card><mat-card>Maltese</mat-card>
3+
<mat-card>Chihuahua</mat-card>
4+
<mat-card>
5+
Welsh Corgi
6+
<mat-card
7+
class="example-card">
8+
Cardigan Welsh Corgi
9+
</mat-card>
10+
<mat-card
11+
class="example-card">
12+
Pembroke Welsh Corgi
13+
</mat-card>
14+
</mat-card>

0 commit comments

Comments
 (0)