Skip to content

Commit f9a1186

Browse files
authored
Merge branch '10.2.x' into slider-comments-10.2.x
2 parents 7fae875 + 8848f75 commit f9a1186

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

Lines changed: 3 additions & 4 deletions
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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,32 +138,30 @@ describe('IgxRadio', () => {
138138
expect(nativeRadio.getAttribute('aria-label')).toMatch(fixture.componentInstance.label);
139139
});
140140

141-
it('Disabled state', () => {
141+
it('Disabled state', fakeAsync(() => {
142142
const fixture = TestBed.createComponent(DisabledRadioComponent);
143143
fixture.detectChanges();
144-
145144
const testInstance = fixture.componentInstance;
146-
const radios = testInstance.radios.toArray();
147145

148146
// get the disabled radio button
149-
const radioInstance = radios[1];
150-
const nativeRadio = radioInstance.nativeRadio.nativeElement;
151-
const nativeLabel = radioInstance.nativeLabel.nativeElement;
152-
const placeholderLabel = radioInstance.placeholderLabel.nativeElement;
147+
const componentInstance = testInstance.radios.last;
148+
const radio = componentInstance.nativeRadio.nativeElement;
153149

154-
expect(radios.length).toEqual(2);
155-
expect(radioInstance.disabled).toBe(true);
156-
expect(nativeRadio.disabled).toBe(true);
150+
expect(componentInstance.disabled).toBe(true);
151+
expect(radio.disabled).toBe(true);
157152

158-
nativeRadio.dispatchEvent(new Event('change'));
159-
nativeLabel.click();
160-
placeholderLabel.click();
153+
fixture.detectChanges();
154+
155+
const btn = fixture.debugElement.queryAll(By.css('igx-radio'))[1];
156+
btn.nativeElement.click();
157+
tick();
161158
fixture.detectChanges();
162159

163160
// Should not update
164-
expect(nativeRadio.checked).toBe(false);
161+
expect(componentInstance.nativeRadio.nativeElement.checked).toBe(false);
162+
expect(radio.checked).toBe(false);
165163
expect(testInstance.selected).not.toEqual('Bar');
166-
});
164+
}));
167165

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

0 commit comments

Comments
 (0)