Skip to content

Commit

Permalink
chore: many typos
Browse files Browse the repository at this point in the history
  • Loading branch information
crisbeto committed Aug 5, 2017
1 parent 9200c6f commit 32e5de8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/lib/core/error/error-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import {FormGroupDirective, NgForm, NgControl} from '@angular/forms';
/** Error state matcher that matches when a control is invalid and dirty. */
@Injectable()
export class ShowOnDirtyErrorStateMatcher implements ErrorStateMatcher {
isErrorSate(control: NgControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: NgControl | null, form: FormGroupDirective | NgForm | null): boolean {
return control ? !!(control.invalid && (control.dirty || (form && form.submitted))) : false;
}
}

/** Provider that defines how form controls behave with regards to displaying error messages. */
@Injectable()
export class ErrorStateMatcher {
isErrorSate(control: NgControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: NgControl | null, form: FormGroupDirective | NgForm | null): boolean {
return control ? !!(control.invalid && (control.touched || (form && form.submitted))) : false;
}
}
4 changes: 2 additions & 2 deletions src/lib/input/input-container.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ describe('MdInputContainer with forms', () => {
MdInputContainerWithFormErrorMessages
],
providers: [
{ provide: ErrorStateMatcher, useValue: { isErrorSate: globalErrorStateMatcher } }
{ provide: ErrorStateMatcher, useValue: { isErrorState: globalErrorStateMatcher } }
]
});

Expand Down Expand Up @@ -1254,7 +1254,7 @@ class MdInputContainerWithCustomErrorStateMatcher {

errorState = false;
customErrorStateMatcher: ErrorStateMatcher = {
isErrorSate: () => this.errorState
isErrorState: () => this.errorState
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/input/input-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export class MdInputDirective implements OnChanges, OnDestroy, DoCheck {
private _updateErrorState() {
let oldState = this._isErrorState;
let matcher = this.errorStateMatcher || this._globalErrorStateMatcher;
let newState = matcher.isErrorSate(this._ngControl, this._parentFormGroup || this._parentForm);
let newState = matcher.isErrorState(this._ngControl, this._parentFormGroup || this._parentForm);

if (newState !== oldState) {
this._isErrorState = newState;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/input/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ By default, error messages are shown when the control is invalid and either the
with (touched) the element or the parent form has been submitted. If you wish to override this
behavior (e.g. to show the error as soon as the invalid control is dirty or when a parent form group
is invalid), you can use the `errorStateMatcher` property of the `mdInput`. To use this property,
create an `ErrorStateMatcher` object in your component class that has a `isErrorSate` function which
create an `ErrorStateMatcher` object in your component class that has a `isErrorState` function which
returns a boolean. A result of `true` will display the error messages.

```html
Expand All @@ -127,7 +127,7 @@ returns a boolean. A result of `true` will display the error messages.

```ts
class MyErrorStateMatcher implements ErrorStateMatcher {
isErrorSate(control: NgControl | null, form: FormGroupDirective | NgForm | null): boolean {
isErrorState(control: NgControl | null, form: FormGroupDirective | NgForm | null): boolean {
// Error when invalid control is dirty, touched, or submitted
const isSubmitted = form && form.submitted;
return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted)));
Expand Down
6 changes: 3 additions & 3 deletions src/lib/select/select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2689,7 +2689,7 @@ describe('MdSelect', () => {
expect(component.control.invalid).toBe(false);
expect(component.select._isErrorState()).toBe(false);

customErrorFixture.componentInstance.errorStateMatcher = { isErrorSate: matcher };
customErrorFixture.componentInstance.errorStateMatcher = { isErrorState: matcher };
customErrorFixture.detectChanges();

expect(component.select._isErrorState()).toBe(true);
Expand All @@ -2698,7 +2698,7 @@ describe('MdSelect', () => {

it('should be able to override the error matching behavior via the injection token', () => {
const errorStateMatcher: ErrorStateMatcher = {
isErrorSate: jasmine.createSpy('error state matcher').and.returnValue(true)
isErrorState: jasmine.createSpy('error state matcher').and.returnValue(true)
};

fixture.destroy();
Expand All @@ -2715,7 +2715,7 @@ describe('MdSelect', () => {
errorFixture.detectChanges();

expect(component.select._isErrorState()).toBe(true);
expect(errorStateMatcher.isErrorSate).toHaveBeenCalled();
expect(errorStateMatcher.isErrorState).toHaveBeenCalled();
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/lib/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ export class MdSelect extends _MdSelectMixinBase implements AfterContentInit, On
/** Whether the select is in an error state. */
_isErrorState(): boolean {
const matcher = this.errorStateMatcher || this._globalErrorStateMatcher;
return matcher.isErrorSate(this._control, this._parentFormGroup || this._parentForm);
return matcher.isErrorState(this._control, this._parentFormGroup || this._parentForm);
}

/**
Expand Down

0 comments on commit 32e5de8

Please sign in to comment.