Skip to content

Commit 4af6601

Browse files
amysortommalerba
authored andcommitted
build: add radio example to mdc-migration integration test
1 parent fad4f9b commit 4af6601

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
@@ -9,4 +9,5 @@
99
<paginator-example></paginator-example>
1010
<progress-bar-example></progress-bar-example>
1111
<progress-spinner-example></progress-spinner-example>
12+
<radio-example></radio-example>
1213
<select-example></select-example>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {MatMenuModule} from '@angular/material-experimental/mdc-menu';
1616
import {MatPaginatorModule} from '@angular/material-experimental/mdc-paginator';
1717
import {MatProgressBarModule} from '@angular/material-experimental/mdc-progress-bar';
1818
import {MatProgressSpinnerModule} from '@angular/material-experimental/mdc-progress-spinner';
19+
import {MatRadioModule} from '@angular/material-experimental/mdc-radio';
1920
import {MatSelectModule} from '@angular/material-experimental/mdc-select';
2021
import {AutocompleteComponent} from './components/autocomplete/autocomplete.component';
2122
import {CardComponent} from './components/card/card.component';
@@ -27,6 +28,7 @@ import {MenuComponent} from './components/menu/menu.component';
2728
import {PaginatorComponent} from './components/paginator/paginator.component';
2829
import {ProgressSpinnerComponent} from './components/progress-spinner/progress-spinner.component';
2930
import {ProgressBarComponent} from './components/progress-bar/progress-bar.component';
31+
import {RadioComponent} from './components/radio/radio.component';
3032
import {SelectComponent} from './components/select/select.component';
3133
import {ButtonComponent} from './components/button/button.component';
3234

@@ -44,6 +46,7 @@ import {ButtonComponent} from './components/button/button.component';
4446
PaginatorComponent,
4547
ProgressBarComponent,
4648
ProgressSpinnerComponent,
49+
RadioComponent,
4750
SelectComponent,
4851
],
4952
imports: [
@@ -61,6 +64,7 @@ import {ButtonComponent} from './components/button/button.component';
6164
MatPaginatorModule,
6265
MatProgressBarModule,
6366
MatProgressSpinnerModule,
67+
MatRadioModule,
6468
MatSelectModule,
6569
ReactiveFormsModule,
6670
],
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<h2>Radio example</h2>
2+
<mat-radio-group>
3+
<mat-radio-button value="1">Dog</mat-radio-button>
4+
<mat-radio-button value="2">Cat</mat-radio-button>
5+
</mat-radio-group>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.mat-mdc-radio-button { padding: 16px; }
2+
3+
/* TODO: The following rule targets internal classes of radio that may no longer apply for the MDC version. */
4+
5+
.mat-radio-container {
6+
padding: 16px;
7+
}
8+
9+
10+
.mat-mdc-radio-group {
11+
display: block;
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 {MatRadioModule} from '@angular/material/radio';
4+
import {RadioComponent} from './radio.component';
5+
6+
describe('RadioComponent', () => {
7+
let component: RadioComponent;
8+
let fixture: ComponentFixture<RadioComponent>;
9+
10+
beforeEach(async () => {
11+
await TestBed.configureTestingModule({
12+
imports: [BrowserAnimationsModule, MatRadioModule],
13+
declarations: [RadioComponent],
14+
}).compileComponents();
15+
});
16+
17+
beforeEach(() => {
18+
fixture = TestBed.createComponent(RadioComponent);
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: 'radio-example',
5+
templateUrl: './radio.component.html',
6+
styleUrls: ['./radio.component.scss'],
7+
})
8+
export class RadioComponent 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
@@ -54,6 +54,8 @@ $sample-project-theme: mat.define-light-theme((
5454
@include mat.mdc-progress-bar-typography($sample-project-theme);
5555
@include mat.mdc-progress-spinner-theme($sample-project-theme);
5656
@include mat.mdc-progress-spinner-typography($sample-project-theme);
57+
@include mat.mdc-radio-theme($sample-project-theme);
58+
@include mat.mdc-radio-typography($sample-project-theme);
5759
@include mat.mdc-select-theme($sample-project-theme);
5860
@include mat.mdc-select-typography($sample-project-theme);
5961
@include mat.mdc-core-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
@@ -9,4 +9,5 @@
99
<paginator-example></paginator-example>
1010
<progress-bar-example></progress-bar-example>
1111
<progress-spinner-example></progress-spinner-example>
12+
<radio-example></radio-example>
1213
<select-example></select-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
@@ -16,6 +16,7 @@ import {MatMenuModule} from '@angular/material/menu';
1616
import {MatPaginatorModule} from '@angular/material/paginator';
1717
import {MatProgressBarModule} from '@angular/material/progress-bar';
1818
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
19+
import {MatRadioModule} from '@angular/material/radio';
1920
import {MatSelectModule} from '@angular/material/select';
2021
import {AutocompleteComponent} from './components/autocomplete/autocomplete.component';
2122
import {CardComponent} from './components/card/card.component';
@@ -27,6 +28,7 @@ import {MenuComponent} from './components/menu/menu.component';
2728
import {PaginatorComponent} from './components/paginator/paginator.component';
2829
import {ProgressSpinnerComponent} from './components/progress-spinner/progress-spinner.component';
2930
import {ProgressBarComponent} from './components/progress-bar/progress-bar.component';
31+
import {RadioComponent} from './components/radio/radio.component';
3032
import {SelectComponent} from './components/select/select.component';
3133
import {ButtonComponent} from './components/button/button.component';
3234

@@ -44,6 +46,7 @@ import {ButtonComponent} from './components/button/button.component';
4446
PaginatorComponent,
4547
ProgressBarComponent,
4648
ProgressSpinnerComponent,
49+
RadioComponent,
4750
SelectComponent,
4851
],
4952
imports: [
@@ -61,6 +64,7 @@ import {ButtonComponent} from './components/button/button.component';
6164
MatPaginatorModule,
6265
MatProgressBarModule,
6366
MatProgressSpinnerModule,
67+
MatRadioModule,
6468
MatSelectModule,
6569
ReactiveFormsModule,
6670
],
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<h2>Radio example</h2>
2+
<mat-radio-group>
3+
<mat-radio-button value="1">Dog</mat-radio-button>
4+
<mat-radio-button value="2">Cat</mat-radio-button>
5+
</mat-radio-group>

0 commit comments

Comments
 (0)