@@ -133,32 +133,30 @@ describe('IgxRadio', () => {
133
133
expect ( nativeRadio . getAttribute ( 'aria-label' ) ) . toMatch ( fixture . componentInstance . label ) ;
134
134
} ) ;
135
135
136
- it ( 'Disabled state' , ( ) => {
136
+ it ( 'Disabled state' , fakeAsync ( ( ) => {
137
137
const fixture = TestBed . createComponent ( DisabledRadioComponent ) ;
138
138
fixture . detectChanges ( ) ;
139
-
140
139
const testInstance = fixture . componentInstance ;
141
- const radios = testInstance . radios . toArray ( ) ;
142
140
143
141
// 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 ;
148
144
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 ) ;
152
147
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 ( ) ;
156
153
fixture . detectChanges ( ) ;
157
154
158
155
// Should not update
159
- expect ( nativeRadio . checked ) . toBe ( false ) ;
156
+ expect ( componentInstance . nativeRadio . nativeElement . checked ) . toBe ( false ) ;
157
+ expect ( radio . checked ) . toBe ( false ) ;
160
158
expect ( testInstance . selected ) . not . toEqual ( 'Bar' ) ;
161
- } ) ;
159
+ } ) ) ;
162
160
163
161
it ( 'Required state' , ( ) => {
164
162
const fixture = TestBed . createComponent ( RequiredRadioComponent ) ;
0 commit comments