Skip to content

Commit

Permalink
fixed group ripple disabled test
Browse files Browse the repository at this point in the history
  • Loading branch information
tinayuangao committed Jan 18, 2017
1 parent 6db630e commit ec34eb8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/lib/radio/radio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ describe('MdRadio', () => {
let rippleElement = radioNativeElements[0].querySelector('[md-ripple]');
expect(rippleElement).toBeTruthy('Expected an enabled radio button to have a ripple');

radioInstances[0].disabled = true;
testComponent.isFirstDisabled = true;
fixture.detectChanges();

rippleElement = radioNativeElements[0].querySelector('[md-ripple]');
Expand Down Expand Up @@ -591,7 +591,8 @@ describe('MdRadio', () => {
[labelPosition]="labelPos"
[value]="groupValue"
name="test-name">
<md-radio-button value="fire" [disableRipple]="disableRipple">Charmander</md-radio-button>
<md-radio-button value="fire" [disableRipple]="disableRipple"
[disabled]="isFirstDisabled">Charmander</md-radio-button>
<md-radio-button value="water" [disableRipple]="disableRipple">Squirtle</md-radio-button>
<md-radio-button value="leaf" [disableRipple]="disableRipple">Bulbasaur</md-radio-button>
</md-radio-group>
Expand All @@ -600,6 +601,7 @@ describe('MdRadio', () => {
class RadiosInsideRadioGroup {
labelPos: 'before' | 'after';
isGroupDisabled: boolean = false;
isFirstDisabled: boolean = false;
groupValue: string = null;
disableRipple: boolean = false;
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib/radio/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
set labelPosition(v) {
this._labelPosition = (v == 'before') ? 'before' : 'after';
if (this._radios) {
this._radios.forEach(radio => radio.groupValueChanged());
this._radios.forEach(radio => radio._groupValueChanged());
}
}

Expand All @@ -150,7 +150,7 @@ export class MdRadioGroup implements AfterContentInit, ControlValueAccessor {
// The presence of *any* disabled value makes the component disabled, *except* for false.
this._disabled = (value != null && value !== false) ? true : null;
if (this._radios) {
this._radios.forEach(radio => radio.groupValueChanged());
this._radios.forEach(radio => radio._groupValueChanged());
}
}

Expand Down Expand Up @@ -446,7 +446,7 @@ export class MdRadioButton implements OnInit {
this._disabled = (value != null && value !== false) ? true : null;
}

groupValueChanged() {
_groupValueChanged() {
this._changeDetector.markForCheck();
}

Expand Down

0 comments on commit ec34eb8

Please sign in to comment.