Skip to content

Commit 7f089e2

Browse files
authored
docs(material/radio): switch examples and demo to MDC (#25572)
1 parent 9621eef commit 7f089e2

File tree

16 files changed

+75
-78
lines changed

16 files changed

+75
-78
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@
190190
/src/dev-app/legacy-list/** @mmalerba
191191
/src/dev-app/legacy-menu/** @crisbeto
192192
/src/dev-app/legacy-paginator/** @crisbeto
193+
/src/dev-app/legacy-radio/** @andrewseguin @devversion
193194
/src/dev-app/legacy-select/** @crisbeto
194195
/src/dev-app/legacy-snack-bar/** @andrewseguin
195196
/src/dev-app/legacy-table/** @andrewseguin
@@ -202,7 +203,6 @@
202203
/src/dev-app/mdc-chips/** @mmalerba
203204
/src/dev-app/mdc-progress-bar/** @crisbeto
204205
/src/dev-app/mdc-progress-spinner/** @mmalerba
205-
/src/dev-app/mdc-radio/** @mmalerba
206206
/src/dev-app/mdc-slide-toggle/** @crisbeto
207207
/src/dev-app/mdc-slider/** @devversion
208208
/src/dev-app/mdc-snack-bar/** @andrewseguin
@@ -216,7 +216,7 @@
216216
/src/dev-app/portal/** @andrewseguin
217217
/src/dev-app/progress-bar/** @andrewseguin @crisbeto
218218
/src/dev-app/progress-spinner/** @andrewseguin @crisbeto
219-
/src/dev-app/radio/** @andrewseguin @devversion
219+
/src/dev-app/radio/** @mmalerba
220220
/src/dev-app/ripple/** @devversion
221221
/src/dev-app/screen-type/** @andrewseguin
222222
/src/dev-app/select/** @crisbeto

src/components-examples/material/radio/BUILD.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ ng_module(
1515
deps = [
1616
"//src/cdk/testing",
1717
"//src/cdk/testing/testbed",
18-
"//src/material/legacy-radio",
19-
"//src/material/legacy-radio/testing",
18+
"//src/material/radio",
19+
"//src/material/radio/testing",
2020
"@npm//@angular/forms",
2121
"@npm//@angular/platform-browser",
2222
"@npm//@angular/platform-browser-dynamic",
@@ -40,8 +40,8 @@ ng_test_library(
4040
":radio",
4141
"//src/cdk/testing",
4242
"//src/cdk/testing/testbed",
43-
"//src/material/legacy-radio",
44-
"//src/material/legacy-radio/testing",
43+
"//src/material/radio",
44+
"//src/material/radio/testing",
4545
"@npm//@angular/forms",
4646
"@npm//@angular/platform-browser-dynamic",
4747
],

src/components-examples/material/radio/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {CommonModule} from '@angular/common';
22
import {NgModule} from '@angular/core';
33
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
4-
import {MatLegacyRadioModule} from '@angular/material/legacy-radio';
4+
import {MatRadioModule} from '@angular/material/radio';
55
import {RadioNgModelExample} from './radio-ng-model/radio-ng-model-example';
66
import {RadioOverviewExample} from './radio-overview/radio-overview-example';
77
import {RadioHarnessExample} from './radio-harness/radio-harness-example';
@@ -11,7 +11,7 @@ export {RadioHarnessExample, RadioNgModelExample, RadioOverviewExample};
1111
const EXAMPLES = [RadioHarnessExample, RadioNgModelExample, RadioOverviewExample];
1212

1313
@NgModule({
14-
imports: [ReactiveFormsModule, CommonModule, MatLegacyRadioModule, FormsModule],
14+
imports: [ReactiveFormsModule, CommonModule, MatRadioModule, FormsModule],
1515
declarations: EXAMPLES,
1616
exports: EXAMPLES,
1717
})

src/components-examples/material/radio/radio-harness/radio-harness-example.spec.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import {ComponentFixture, TestBed} from '@angular/core/testing';
22
import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed';
3-
import {
4-
MatLegacyRadioButtonHarness,
5-
MatLegacyRadioGroupHarness,
6-
} from '@angular/material/legacy-radio/testing';
3+
import {MatRadioButtonHarness, MatRadioGroupHarness} from '@angular/material/radio/testing';
74
import {HarnessLoader} from '@angular/cdk/testing';
8-
import {MatLegacyRadioModule} from '@angular/material/legacy-radio';
5+
import {MatRadioModule} from '@angular/material/radio';
96
import {RadioHarnessExample} from './radio-harness-example';
107
import {ReactiveFormsModule} from '@angular/forms';
118

@@ -15,7 +12,7 @@ describe('RadioHarnessExample', () => {
1512

1613
beforeEach(async () => {
1714
await TestBed.configureTestingModule({
18-
imports: [MatLegacyRadioModule, ReactiveFormsModule],
15+
imports: [MatRadioModule, ReactiveFormsModule],
1916
declarations: [RadioHarnessExample],
2017
}).compileComponents();
2118
fixture = TestBed.createComponent(RadioHarnessExample);
@@ -24,18 +21,18 @@ describe('RadioHarnessExample', () => {
2421
});
2522

2623
it('should load all radio-group harnesses', async () => {
27-
const groups = await loader.getAllHarnesses(MatLegacyRadioGroupHarness);
24+
const groups = await loader.getAllHarnesses(MatRadioGroupHarness);
2825
expect(groups.length).toBe(1);
2926
});
3027

3128
it('should get name of radio-group', async () => {
32-
const group = await loader.getHarness(MatLegacyRadioGroupHarness);
29+
const group = await loader.getHarness(MatRadioGroupHarness);
3330
const name = await group.getName();
3431
expect(name).toBe('flavors');
3532
});
3633

3734
it('should check radio button', async () => {
38-
const buttons = await loader.getAllHarnesses(MatLegacyRadioButtonHarness);
35+
const buttons = await loader.getAllHarnesses(MatRadioButtonHarness);
3936
expect(await buttons[0].isChecked()).toBeTrue();
4037

4138
await buttons[1].check();
@@ -45,7 +42,7 @@ describe('RadioHarnessExample', () => {
4542

4643
it('should get label text of buttons', async () => {
4744
const [firstRadio, secondRadio, thirdRadio] = await loader.getAllHarnesses(
48-
MatLegacyRadioButtonHarness,
45+
MatRadioButtonHarness,
4946
);
5047
expect(await firstRadio.getLabelText()).toBe('Chocolate');
5148
expect(await secondRadio.getLabelText()).toBe('Vanilla');
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
.mat-radio-button ~ .mat-radio-button {
1+
.mat-mdc-radio-button ~ .mat-mdc-radio-button {
22
margin-left: 16px;
33
}

src/dev-app/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ ng_module(
5555
"//src/dev-app/legacy-list",
5656
"//src/dev-app/legacy-menu",
5757
"//src/dev-app/legacy-paginator",
58+
"//src/dev-app/legacy-radio",
5859
"//src/dev-app/legacy-select",
5960
"//src/dev-app/legacy-snack-bar",
6061
"//src/dev-app/legacy-table",
@@ -65,7 +66,6 @@ ng_module(
6566
"//src/dev-app/mdc-chips",
6667
"//src/dev-app/mdc-progress-bar",
6768
"//src/dev-app/mdc-progress-spinner",
68-
"//src/dev-app/mdc-radio",
6969
"//src/dev-app/mdc-slide-toggle",
7070
"//src/dev-app/mdc-slider",
7171
"//src/dev-app/mdc-tabs",

src/dev-app/dev-app/dev-app-layout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ export class DevAppLayout {
107107
{name: 'MDC Chips', route: '/mdc-chips'},
108108
{name: 'MDC Progress Bar', route: '/mdc-progress-bar'},
109109
{name: 'MDC Progress Spinner', route: '/mdc-progress-spinner'},
110-
{name: 'MDC Radio', route: '/mdc-radio'},
111110
{name: 'MDC Slide Toggle', route: '/mdc-slide-toggle'},
112111
{name: 'MDC Slider', route: '/mdc-slider'},
113112
{name: 'MDC Tabs', route: '/mdc-tabs'},
@@ -119,6 +118,7 @@ export class DevAppLayout {
119118
{name: 'Legacy List', route: '/legacy-list'},
120119
{name: 'Legacy Menu', route: '/legacy-menu'},
121120
{name: 'Legacy Paginator', route: '/legacy-paginator'},
121+
{name: 'Legacy Radio', route: '/legacy-radio'},
122122
{name: 'Legacy Select', route: '/legacy-select'},
123123
{name: 'Legacy Snack Bar', route: '/legacy-snack-bar'},
124124
{name: 'Legacy Table', route: '/legacy-table'},

src/dev-app/legacy-radio/BUILD.bazel

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
load("//tools:defaults.bzl", "ng_module", "sass_binary")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
ng_module(
6+
name = "legacy-radio",
7+
srcs = glob(["**/*.ts"]),
8+
assets = [
9+
"legacy-radio-demo.html",
10+
":legacy_radio_demo_scss",
11+
],
12+
deps = [
13+
"//src/material/legacy-button",
14+
"//src/material/legacy-checkbox",
15+
"//src/material/legacy-radio",
16+
"@npm//@angular/forms",
17+
],
18+
)
19+
20+
sass_binary(
21+
name = "legacy_radio_demo_scss",
22+
src = "legacy-radio-demo.scss",
23+
)

src/dev-app/mdc-radio/mdc-radio-demo.html renamed to src/dev-app/legacy-radio/legacy-radio-demo.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,15 @@ <h1>Dynamic Example</h1>
4141
<span><mat-checkbox [(ngModel)]="isAlignEnd">Align end</mat-checkbox></span>
4242
</div>
4343
<mat-radio-group
44-
name="my_options"
45-
[disabled]="isDisabled"
46-
[required]="isRequired"
47-
[labelPosition]="isAlignEnd ? 'after' : 'before'">
44+
name="my_options"
45+
[disabled]="isDisabled"
46+
[required]="isRequired"
47+
[labelPosition]="isAlignEnd ? 'after' : 'before'">
4848
<mat-radio-button value="option_1">Option 1</mat-radio-button>
4949
<mat-radio-button value="option_2">Option 2</mat-radio-button>
5050
<mat-radio-button value="option_3">Option 3</mat-radio-button>
5151
</mat-radio-group>
5252
</section>
53-
5453
<h1>Favorite Season Example</h1>
5554
<h2>Dynamic Example with two-way data-binding</h2>
5655
<section class="demo-section">

0 commit comments

Comments
 (0)