Skip to content

Commit 3fda4b7

Browse files
committed
docs(material/autocomplete): switch docs to use MDC
Changes the docs for the autocomplete to use MDC implementation.
1 parent 69f58c3 commit 3fda4b7

File tree

5 files changed

+31
-29
lines changed

5 files changed

+31
-29
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ ng_module(
1616
"//src/cdk/overlay",
1717
"//src/cdk/testing",
1818
"//src/cdk/testing/testbed",
19-
"//src/material/legacy-autocomplete",
20-
"//src/material/legacy-autocomplete/testing",
21-
"//src/material/legacy-form-field",
22-
"//src/material/legacy-input",
23-
"//src/material/legacy-slide-toggle",
19+
"//src/material/autocomplete",
20+
"//src/material/autocomplete/testing",
21+
"//src/material/form-field",
22+
"//src/material/input",
23+
"//src/material/slide-toggle",
2424
"@npm//@angular/forms",
2525
"@npm//@angular/platform-browser",
2626
"@npm//@angular/platform-browser-dynamic",
@@ -44,8 +44,8 @@ ng_test_library(
4444
":autocomplete",
4545
"//src/cdk/testing",
4646
"//src/cdk/testing/testbed",
47-
"//src/material/legacy-autocomplete",
48-
"//src/material/legacy-autocomplete/testing",
47+
"//src/material/autocomplete",
48+
"//src/material/autocomplete/testing",
4949
"@npm//@angular/platform-browser-dynamic",
5050
],
5151
)

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

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {ComponentFixture, TestBed} from '@angular/core/testing';
22
import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed';
3-
import {MatLegacyAutocompleteHarness} from '@angular/material/legacy-autocomplete/testing';
3+
import {MatAutocompleteHarness} from '@angular/material/autocomplete/testing';
44
import {HarnessLoader} from '@angular/cdk/testing';
5-
import {MatLegacyAutocompleteModule} from '@angular/material/legacy-autocomplete';
5+
import {MatAutocompleteModule} from '@angular/material/autocomplete';
66
import {AutocompleteHarnessExample} from './autocomplete-harness-example';
77

88
describe('AutocompleteHarnessExample', () => {
@@ -11,7 +11,7 @@ describe('AutocompleteHarnessExample', () => {
1111

1212
beforeEach(async () => {
1313
await TestBed.configureTestingModule({
14-
imports: [MatLegacyAutocompleteModule],
14+
imports: [MatAutocompleteModule],
1515
declarations: [AutocompleteHarnessExample],
1616
}).compileComponents();
1717
fixture = TestBed.createComponent(AutocompleteHarnessExample);
@@ -20,24 +20,20 @@ describe('AutocompleteHarnessExample', () => {
2020
});
2121

2222
it('should load all autocomplete harnesses', async () => {
23-
const autocompletes = await loader.getAllHarnesses(MatLegacyAutocompleteHarness);
23+
const autocompletes = await loader.getAllHarnesses(MatAutocompleteHarness);
2424
expect(autocompletes.length).toBe(2);
2525
});
2626

2727
it('should get disabled state', async () => {
28-
const enabled = await loader.getHarness(
29-
MatLegacyAutocompleteHarness.with({selector: '#plain'}),
30-
);
31-
const disabled = await loader.getHarness(
32-
MatLegacyAutocompleteHarness.with({selector: '#disabled'}),
33-
);
28+
const enabled = await loader.getHarness(MatAutocompleteHarness.with({selector: '#plain'}));
29+
const disabled = await loader.getHarness(MatAutocompleteHarness.with({selector: '#disabled'}));
3430

3531
expect(await enabled.isDisabled()).toBe(false);
3632
expect(await disabled.isDisabled()).toBe(true);
3733
});
3834

3935
it('should focus and blur an input', async () => {
40-
const input = await loader.getHarness(MatLegacyAutocompleteHarness.with({selector: '#plain'}));
36+
const input = await loader.getHarness(MatAutocompleteHarness.with({selector: '#plain'}));
4137
expect(await input.isFocused()).toBe(false);
4238
await input.focus();
4339
expect(await input.isFocused()).toBe(true);
@@ -46,13 +42,13 @@ describe('AutocompleteHarnessExample', () => {
4642
});
4743

4844
it('should be able to type in an input', async () => {
49-
const input = await loader.getHarness(MatLegacyAutocompleteHarness.with({selector: '#plain'}));
45+
const input = await loader.getHarness(MatAutocompleteHarness.with({selector: '#plain'}));
5046
await input.enterText('Hello there');
5147
expect(await input.getValue()).toBe('Hello there');
5248
});
5349

5450
it('should be able to get filtered options', async () => {
55-
const input = await loader.getHarness(MatLegacyAutocompleteHarness.with({selector: '#plain'}));
51+
const input = await loader.getHarness(MatAutocompleteHarness.with({selector: '#plain'}));
5652
await input.focus();
5753
const options = await input.getOptions({text: /New/});
5854

src/components-examples/material/autocomplete/autocomplete-plain-input/autocomplete-plain-input-example.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@
77
.example-full-width {
88
width: 100%;
99
}
10+
11+
.example-input {
12+
max-width: 100%;
13+
width: 300px;
14+
}

src/components-examples/material/autocomplete/autocomplete-plain-input/autocomplete-plain-input-example.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<input type="text"
33
placeholder="Search for a street"
44
[formControl]="control"
5-
[matAutocomplete]="auto">
5+
[matAutocomplete]="auto"
6+
class="example-input">
67
<mat-autocomplete #auto="matAutocomplete">
78
<mat-option *ngFor="let street of filteredStreets | async" [value]="street">
89
{{street}}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {CommonModule} from '@angular/common';
22
import {NgModule} from '@angular/core';
33
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
4-
import {MatLegacyAutocompleteModule} from '@angular/material/legacy-autocomplete';
5-
import {MatLegacyFormFieldModule} from '@angular/material/legacy-form-field';
6-
import {MatLegacyInputModule} from '@angular/material/legacy-input';
7-
import {MatLegacySlideToggleModule} from '@angular/material/legacy-slide-toggle';
4+
import {MatAutocompleteModule} from '@angular/material/autocomplete';
5+
import {MatFormFieldModule} from '@angular/material/form-field';
6+
import {MatInputModule} from '@angular/material/input';
7+
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
88
import {AutocompleteAutoActiveFirstOptionExample} from './autocomplete-auto-active-first-option/autocomplete-auto-active-first-option-example';
99
import {AutocompleteDisplayExample} from './autocomplete-display/autocomplete-display-example';
1010
import {AutocompleteFilterExample} from './autocomplete-filter/autocomplete-filter-example';
@@ -39,10 +39,10 @@ const EXAMPLES = [
3939
@NgModule({
4040
imports: [
4141
CommonModule,
42-
MatLegacyAutocompleteModule,
43-
MatLegacyFormFieldModule,
44-
MatLegacyInputModule,
45-
MatLegacySlideToggleModule,
42+
MatAutocompleteModule,
43+
MatFormFieldModule,
44+
MatInputModule,
45+
MatSlideToggleModule,
4646
FormsModule,
4747
ReactiveFormsModule,
4848
],

0 commit comments

Comments
 (0)