Skip to content

Commit 700c060

Browse files
authored
refactor(material/form-field): remove deprecated APIs for version 13 (#23389)
BREAKING CHANGE: * `MatFormFieldHarness.getHarnessLoaderForPrefix` has been removed. Use `MatFormFieldHarness.getPrefixText` instead. * `MatFormFieldHarness.getHarnessLoaderForSuffix` has been removed. Use `MatFormFieldHarness.getSuffixText` instead. * The `_labelOptions` parameter of the `MatFormField` constructor has been removed. * `MatFormField.underlineRef` has been removed.
1 parent 3ad0894 commit 700c060

File tree

6 files changed

+9
-43
lines changed

6 files changed

+9
-43
lines changed

src/material/form-field/form-field.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
</div>
6464

6565
<!-- Underline used for legacy, standard, and box appearances. -->
66-
<div class="mat-form-field-underline" #underline
66+
<div class="mat-form-field-underline"
6767
*ngIf="appearance != 'outline'">
6868
<span class="mat-form-field-ripple"
6969
[class.mat-accent]="color == 'accent'"

src/material/form-field/form-field.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,6 @@ export class MatFormField extends _MatFormFieldBase
235235
/** Whether the Angular animations are enabled. */
236236
_animationsEnabled: boolean;
237237

238-
/**
239-
* @deprecated
240-
* @breaking-change 8.0.0
241-
*/
242-
@ViewChild('underline') underlineRef: ElementRef;
243-
244238
@ViewChild('connectionContainer', {static: true}) _connectionContainerRef: ElementRef;
245239
@ViewChild('inputContainer') _inputContainerRef: ElementRef;
246240
@ViewChild('label') private _label: ElementRef<HTMLElement>;
@@ -268,13 +262,6 @@ export class MatFormField extends _MatFormFieldBase
268262

269263
constructor(
270264
elementRef: ElementRef, private _changeDetectorRef: ChangeDetectorRef,
271-
/**
272-
* @deprecated `_labelOptions` parameter no longer being used. To be removed.
273-
* @breaking-change 12.0.0
274-
*/
275-
@Inject(ElementRef)
276-
// Use `ElementRef` here so Angular has something to inject.
277-
_labelOptions: any,
278265
@Optional() private _dir: Directionality,
279266
@Optional() @Inject(MAT_FORM_FIELD_DEFAULT_OPTIONS) private _defaults:
280267
MatFormFieldDefaultOptions, private _platform: Platform, private _ngZone: NgZone,

src/material/form-field/testing/form-field-harness.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -134,32 +134,12 @@ export abstract class _MatFormFieldHarnessBase<ControlHarness extends MatFormFie
134134
return parallel(() => hints.map(e => e.text()));
135135
}
136136

137-
/**
138-
* Gets a reference to the container element which contains all projected
139-
* prefixes of the form-field.
140-
* @deprecated Use `getPrefixText` instead.
141-
* @breaking-change 11.0.0
142-
*/
143-
async getHarnessLoaderForPrefix(): Promise<TestElement|null> {
144-
return this._prefixContainer();
145-
}
146-
147137
/** Gets the text inside the prefix element. */
148138
async getPrefixText(): Promise<string> {
149139
const prefix = await this._prefixContainer();
150140
return prefix ? prefix.text() : '';
151141
}
152142

153-
/**
154-
* Gets a reference to the container element which contains all projected
155-
* suffixes of the form-field.
156-
* @deprecated Use `getSuffixText` instead.
157-
* @breaking-change 11.0.0
158-
*/
159-
async getHarnessLoaderForSuffix(): Promise<TestElement|null> {
160-
return this._suffixContainer();
161-
}
162-
163143
/** Gets the text inside the suffix element. */
164144
async getSuffixText(): Promise<string> {
165145
const suffix = await this._suffixContainer();

src/material/schematics/ng-update/data/constructor-checks.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ import {ConstructorChecksUpgradeData, TargetVersion, VersionChanges} from '@angu
1414
* automatically through type checking.
1515
*/
1616
export const constructorChecks: VersionChanges<ConstructorChecksUpgradeData> = {
17+
[TargetVersion.V13]: [
18+
{
19+
pr: 'https://github.com/angular/components/pull/23389',
20+
changes: ['MatFormField']
21+
}
22+
],
1723
[TargetVersion.V12]: [
1824
{
1925
pr: 'https://github.com/angular/components/pull/21897',

tools/public_api_guard/material/form-field-testing.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ export abstract class _MatFormFieldHarnessBase<ControlHarness extends MatFormFie
6565
getControl(): Promise<ControlHarness | null>;
6666
getControl<X extends MatFormFieldControlHarness>(type: ComponentHarnessConstructor<X>): Promise<X | null>;
6767
getControl<X extends MatFormFieldControlHarness>(type: HarnessPredicate<X>): Promise<X | null>;
68-
// @deprecated
69-
getHarnessLoaderForPrefix(): Promise<TestElement | null>;
70-
// @deprecated
71-
getHarnessLoaderForSuffix(): Promise<TestElement | null>;
7268
getLabel(): Promise<string | null>;
7369
getPrefixText(): Promise<string>;
7470
getSuffixText(): Promise<string>;

tools/public_api_guard/material/form-field.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ export class MatError {
7070

7171
// @public
7272
export class MatFormField extends _MatFormFieldBase implements AfterContentInit, AfterContentChecked, AfterViewInit, OnDestroy, CanColor {
73-
constructor(elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef,
74-
_labelOptions: any, _dir: Directionality, _defaults: MatFormFieldDefaultOptions, _platform: Platform, _ngZone: NgZone, _animationMode: string);
73+
constructor(elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef, _dir: Directionality, _defaults: MatFormFieldDefaultOptions, _platform: Platform, _ngZone: NgZone, _animationMode: string);
7574
_animateAndLockLabel(): void;
7675
_animationsEnabled: boolean;
7776
get appearance(): MatFormFieldAppearance;
@@ -140,14 +139,12 @@ export class MatFormField extends _MatFormFieldBase implements AfterContentInit,
140139
_subscriptAnimationState: string;
141140
// (undocumented)
142141
_suffixChildren: QueryList<MatSuffix>;
143-
// @deprecated (undocumented)
144-
underlineRef: ElementRef;
145142
updateOutlineGap(): void;
146143
protected _validateControlChild(): void;
147144
// (undocumented)
148145
static ɵcmp: i0.ɵɵComponentDeclaration<MatFormField, "mat-form-field", ["matFormField"], { "color": "color"; "appearance": "appearance"; "hideRequiredMarker": "hideRequiredMarker"; "hintLabel": "hintLabel"; "floatLabel": "floatLabel"; }, {}, ["_controlNonStatic", "_controlStatic", "_labelChildNonStatic", "_labelChildStatic", "_placeholderChild", "_errorChildren", "_hintChildren", "_prefixChildren", "_suffixChildren"], ["[matPrefix]", "*", "mat-placeholder", "mat-label", "[matSuffix]", "mat-error", "mat-hint:not([align='end'])", "mat-hint[align='end']"]>;
149146
// (undocumented)
150-
static ɵfac: i0.ɵɵFactoryDeclaration<MatFormField, [null, null, null, { optional: true; }, { optional: true; }, null, null, { optional: true; }]>;
147+
static ɵfac: i0.ɵɵFactoryDeclaration<MatFormField, [null, null, { optional: true; }, { optional: true; }, null, null, { optional: true; }]>;
151148
}
152149

153150
// @public

0 commit comments

Comments
 (0)