@@ -152,7 +152,7 @@ describe('MdRadio', () => {
152
152
expect ( spies [ 1 ] ) . toHaveBeenCalledTimes ( 1 ) ;
153
153
} ) ;
154
154
155
- it ( `should not emit a change event from the radio group when change group value
155
+ it ( `should not emit a change event from the radio group when change group value
156
156
programmatically` , ( ) => {
157
157
expect ( groupInstance . value ) . toBeFalsy ( ) ;
158
158
@@ -235,7 +235,7 @@ describe('MdRadio', () => {
235
235
}
236
236
} ) ) ;
237
237
238
- it ( `should update the group's selected radio to null when unchecking that radio
238
+ it ( `should update the group's selected radio to null when unchecking that radio
239
239
programmatically` , ( ) => {
240
240
let changeSpy = jasmine . createSpy ( 'radio-group change listener' ) ;
241
241
groupInstance . change . subscribe ( changeSpy ) ;
@@ -485,6 +485,28 @@ describe('MdRadio', () => {
485
485
486
486
expect ( fruitRadioNativeInputs [ 0 ] . getAttribute ( 'aria-labelledby' ) ) . toBe ( 'uvw' ) ;
487
487
} ) ;
488
+
489
+ it ( 'should make the native input element a tab stop' , ( ) => {
490
+ expect ( fruitRadioNativeInputs [ 0 ] . tabIndex ) . toBe ( 0 ) ;
491
+ } ) ;
492
+
493
+ it ( 'should add a ripple when the native input element is focused' , ( ) => {
494
+ let hostElement = seasonRadioInstances [ 0 ] . getHostElement ( ) as HTMLElement ;
495
+ let input = hostElement . querySelector ( 'input' ) as HTMLInputElement ;
496
+ let label = hostElement . querySelector ( 'label' ) as HTMLLabelElement ;
497
+
498
+ expect ( label . classList ) . not . toContain ( 'md-ripple-focused' ) ;
499
+
500
+ dispatchEvent ( 'focus' , input ) ;
501
+ fixture . detectChanges ( ) ;
502
+
503
+ expect ( label . classList ) . toContain ( 'md-ripple-focused' ) ;
504
+
505
+ dispatchEvent ( 'blur' , input ) ;
506
+ fixture . detectChanges ( ) ;
507
+
508
+ expect ( label . classList ) . not . toContain ( 'md-ripple-focused' ) ;
509
+ } ) ;
488
510
} ) ;
489
511
} ) ;
490
512
@@ -514,11 +536,11 @@ class RadiosInsideRadioGroup {
514
536
<md-radio-button name="season" value="spring">Spring</md-radio-button>
515
537
<md-radio-button name="season" value="summer">Summer</md-radio-button>
516
538
<md-radio-button name="season" value="autum">Autumn</md-radio-button>
517
-
539
+
518
540
<md-radio-button name="weather" value="warm">Spring</md-radio-button>
519
541
<md-radio-button name="weather" value="hot">Summer</md-radio-button>
520
542
<md-radio-button name="weather" value="cool">Autumn</md-radio-button>
521
-
543
+
522
544
<span id="xyz">Baby Banana</span>
523
545
<md-radio-button name="fruit" value="banana" aria-label="Banana" aria-labelledby="xyz">
524
546
</md-radio-button>
0 commit comments