Skip to content

Commit 0dea207

Browse files
authored
Merge branch 'master' into dTsvetkov/fix-8207-master
2 parents d57f029 + 2b56923 commit 0dea207

File tree

3 files changed

+118
-64
lines changed

3 files changed

+118
-64
lines changed

projects/igniteui-angular/src/lib/radio/radio.component.html

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
[attr.aria-checked]="checked"
1010
[attr.aria-labelledby]="ariaLabelledBy"
1111
[attr.aria-label]="ariaLabel"
12-
(click)="_onRadioClick($event)"
13-
(change)="_onRadioChange($event)"
12+
(click)="_clicked($event)"
1413
(focus)="onFocus()"
1514
(blur)="onBlur()" />
1615

@@ -24,8 +23,8 @@
2423
</label>
2524

2625
<span #placeholderLabel
26+
(click)="_clicked($event)"
2727
[id]="labelId"
28-
[class]="labelClass"
29-
(click)="_onLabelClick()">
28+
[class]="labelClass">
3029
<ng-content></ng-content>
3130
</span>

projects/igniteui-angular/src/lib/radio/radio.component.spec.ts

+13-15
Original file line numberDiff line numberDiff line change
@@ -133,32 +133,30 @@ describe('IgxRadio', () => {
133133
expect(nativeRadio.getAttribute('aria-label')).toMatch(fixture.componentInstance.label);
134134
});
135135

136-
it('Disabled state', () => {
136+
it('Disabled state', fakeAsync(() => {
137137
const fixture = TestBed.createComponent(DisabledRadioComponent);
138138
fixture.detectChanges();
139-
140139
const testInstance = fixture.componentInstance;
141-
const radios = testInstance.radios.toArray();
142140

143141
// get the disabled radio button
144-
const radioInstance = radios[1];
145-
const nativeRadio = radioInstance.nativeRadio.nativeElement;
146-
const nativeLabel = radioInstance.nativeLabel.nativeElement;
147-
const placeholderLabel = radioInstance.placeholderLabel.nativeElement;
142+
const componentInstance = testInstance.radios.last;
143+
const radio = componentInstance.nativeRadio.nativeElement;
148144

149-
expect(radios.length).toEqual(2);
150-
expect(radioInstance.disabled).toBe(true);
151-
expect(nativeRadio.disabled).toBe(true);
145+
expect(componentInstance.disabled).toBe(true);
146+
expect(radio.disabled).toBe(true);
152147

153-
nativeRadio.dispatchEvent(new Event('change'));
154-
nativeLabel.click();
155-
placeholderLabel.click();
148+
fixture.detectChanges();
149+
150+
const btn = fixture.debugElement.queryAll(By.css('igx-radio'))[1];
151+
btn.nativeElement.click();
152+
tick();
156153
fixture.detectChanges();
157154

158155
// Should not update
159-
expect(nativeRadio.checked).toBe(false);
156+
expect(componentInstance.nativeRadio.nativeElement.checked).toBe(false);
157+
expect(radio.checked).toBe(false);
160158
expect(testInstance.selected).not.toEqual('Bar');
161-
});
159+
}));
162160

163161
it('Required state', () => {
164162
const fixture = TestBed.createComponent(RequiredRadioComponent);

0 commit comments

Comments
 (0)