Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(select): required asterisk should use warn color #5498

Merged
merged 1 commit into from
Jul 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/lib/select/_select-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
&.mat-accent {
@include _mat-select-inner-content-theme($accent);
}

&.mat-select-required .mat-select-placeholder::after {
color: mat-color($warn);
}
}

.mat-select:focus:not(.mat-select-disabled).mat-warn,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ $mat-select-panel-max-height: 256px !default;
}

// TODO: Double-check accessibility of this style
[aria-required=true] &::after {
.mat-select-required &::after {
content: '*';
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/lib/select/select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,17 @@ describe('MdSelect', () => {
.toEqual('true', `Expected aria-required attr to be true for required selects.`);
});

it('should set the mat-select-required class for required selects', () => {
expect(select.classList).not.toContain(
'mat-select-required', `Expected the mat-select-required class not to be set.`);

fixture.componentInstance.isRequired = true;
fixture.detectChanges();

expect(select.classList).toContain(
'mat-select-required', `Expected the mat-select-required class to be set.`);
});

it('should set aria-invalid for selects that are invalid', () => {
expect(select.getAttribute('aria-invalid'))
.toEqual('false', `Expected aria-invalid attr to be false for valid selects.`);
Expand Down
1 change: 1 addition & 0 deletions src/lib/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export const _MdSelectMixinBase = mixinColor(mixinDisabled(MdSelectBase), 'prima
'[attr.aria-invalid]': '_control?.invalid || "false"',
'[attr.aria-owns]': '_optionIds',
'[class.mat-select-disabled]': 'disabled',
'[class.mat-select-required]': 'required',
'class': 'mat-select',
'(keydown)': '_handleClosedKeydown($event)',
'(blur)': '_onBlur()',
Expand Down