Skip to content

Commit

Permalink
fixup! feat(material-experimental/mdc-form-field): separate out text …
Browse files Browse the repository at this point in the history
…and icon prefixes/suffixes
  • Loading branch information
mmalerba committed Feb 24, 2021
1 parent d88e750 commit fc17419
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/material/form-field/testing/shared.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {ComponentHarness, HarnessLoader, HarnessPredicate, parallel} from '@angular/cdk/testing';
import {
createFakeEvent,
dispatchFakeEvent,
} from '@angular/cdk/testing/private';
import {createFakeEvent, dispatchFakeEvent} from '@angular/cdk/testing/private';
import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed';
import {Component, Type} from '@angular/core';
import {ComponentFixture, TestBed} from '@angular/core/testing';
Expand Down Expand Up @@ -30,6 +27,7 @@ export function runHarnessTests(
.compileComponents();

fixture = TestBed.createComponent(FormFieldHarnessTest);
fixture.componentInstance.isMdc = isMdcImplementation;
fixture.detectChanges();
loader = TestbedHarnessEnvironment.loader(fixture);
});
Expand Down Expand Up @@ -243,11 +241,14 @@ export function runHarnessTests(
@Component({
template: `
<mat-form-field id="first-form-field" [floatLabel]="shouldLabelFloat">
<span matPrefix>prefix_text</span>
<span matPrefix>prefix_text_2</span>
<span matPrefix *ngIf="!isMdc">prefix_text</span>
<span matPrefix *ngIf="!isMdc">prefix_text_2</span>
<span matTextPrefix *ngIf="isMdc">prefix_text</span>
<span matTextPrefix *ngIf="isMdc">prefix_text_2</span>
<input matInput value="Sushi" name="favorite-food" placeholder="With placeholder"
[disabled]="isDisabled">
<span matSuffix>suffix_text</span>
<span matSuffix *ngIf="!isMdc">suffix_text</span>
<span matTextSuffix *ngIf="isMdc">suffix_text</span>
</mat-form-field>
<mat-form-field appearance="standard" color="warn" id="with-errors">
Expand Down Expand Up @@ -287,6 +288,7 @@ class FormFieldHarnessTest {
shouldLabelFloat: 'always'|'auto' = 'auto';
hasLabel = false;
isDisabled = false;
isMdc = false;

setupAsyncValidator() {
this.requiredControl.setValidators(() => null);
Expand Down

0 comments on commit fc17419

Please sign in to comment.