@@ -6,21 +6,10 @@ import {MdRadioGroup, MdRadioButton, MdRadioChange, MdRadioModule} from './index
66import  { ViewportRuler }  from  '../core/overlay/position/viewport-ruler' ; 
77import  { FakeViewportRuler }  from  '../core/overlay/position/fake-viewport-ruler' ; 
88import  { dispatchFakeEvent }  from  '../core/testing/dispatch-events' ; 
9- import  { FocusOriginMonitor ,  FocusOrigin }  from  '../core' ; 
109import  { RIPPLE_FADE_IN_DURATION ,  RIPPLE_FADE_OUT_DURATION }  from  '../core/ripple/ripple-renderer' ; 
11- import  { Subject }  from  'rxjs/Subject' ; 
1210
1311
1412describe ( 'MdRadio' ,  ( )  =>  { 
15-   let  fakeFocusOriginMonitorStream  =  new  Subject < FocusOrigin > ( ) ; 
16-   let  fakeFocusOriginMonitor  =  { 
17-     monitor : ( )  =>  fakeFocusOriginMonitorStream . asObservable ( ) , 
18-     unmonitor : ( )  =>  { } , 
19-     focusVia : ( element : HTMLElement ,  renderer : any ,  origin : FocusOrigin )  =>  { 
20-       element . focus ( ) ; 
21-       fakeFocusOriginMonitorStream . next ( origin ) ; 
22-     } 
23-   } ; 
2413
2514  beforeEach ( async ( ( )  =>  { 
2615    TestBed . configureTestingModule ( { 
@@ -32,8 +21,7 @@ describe('MdRadio', () => {
3221        StandaloneRadioButtons , 
3322      ] , 
3423      providers : [ 
35-         { provide : ViewportRuler ,  useClass : FakeViewportRuler } , 
36-         { provide : FocusOriginMonitor ,  useValue : fakeFocusOriginMonitor } 
24+         { provide : ViewportRuler ,  useClass : FakeViewportRuler } 
3725      ] 
3826    } ) ; 
3927
@@ -47,6 +35,7 @@ describe('MdRadio', () => {
4735    let  radioDebugElements : DebugElement [ ] ; 
4836    let  radioNativeElements : HTMLElement [ ] ; 
4937    let  radioLabelElements : HTMLLabelElement [ ] ; 
38+     let  radioInputElements : HTMLInputElement [ ] ; 
5039    let  groupInstance : MdRadioGroup ; 
5140    let  radioInstances : MdRadioButton [ ] ; 
5241    let  testComponent : RadiosInsideRadioGroup ; 
@@ -67,6 +56,8 @@ describe('MdRadio', () => {
6756
6857      radioLabelElements  =  radioDebugElements 
6958        . map ( debugEl  =>  debugEl . query ( By . css ( 'label' ) ) . nativeElement ) ; 
59+       radioInputElements  =  radioDebugElements 
60+         . map ( debugEl  =>  debugEl . query ( By . css ( 'input' ) ) . nativeElement ) ; 
7061    } ) ) ; 
7162
7263    it ( 'should set individual radio names based on the group name' ,  ( )  =>  { 
@@ -140,9 +131,7 @@ describe('MdRadio', () => {
140131    } ) ; 
141132
142133    it ( 'should check a radio upon interaction with the underlying native radio button' ,  ( )  =>  { 
143-       let  nativeRadioInput  =  < HTMLElement >  radioNativeElements [ 0 ] . querySelector ( 'input' ) ; 
144- 
145-       nativeRadioInput . click ( ) ; 
134+       radioInputElements [ 0 ] . click ( ) ; 
146135      fixture . detectChanges ( ) ; 
147136
148137      expect ( radioInstances [ 0 ] . checked ) . toBe ( true ) ; 
@@ -194,13 +183,15 @@ describe('MdRadio', () => {
194183      expect ( radioNativeElements [ 0 ] . querySelectorAll ( '.mat-ripple-element' ) . length ) 
195184          . toBe ( 0 ,  'Expected no ripples on init.' ) ; 
196185
197-       fakeFocusOriginMonitorStream . next ( 'keyboard' ) ; 
186+       dispatchFakeEvent ( radioInputElements [ 0 ] ,  'keydown' ) ; 
187+       dispatchFakeEvent ( radioInputElements [ 0 ] ,  'focus' ) ; 
188+ 
198189      tick ( RIPPLE_FADE_IN_DURATION ) ; 
199190
200191      expect ( radioNativeElements [ 0 ] . querySelectorAll ( '.mat-ripple-element' ) . length ) 
201192          . toBe ( 1 ,  'Expected one ripple after keyboard focus.' ) ; 
202193
203-       dispatchFakeEvent ( radioNativeElements [ 0 ] . querySelector ( 'input' ) ,  'blur' ) ; 
194+       dispatchFakeEvent ( radioInputElements [ 0 ] ,  'blur' ) ; 
204195      tick ( RIPPLE_FADE_OUT_DURATION ) ; 
205196
206197      expect ( radioNativeElements [ 0 ] . querySelectorAll ( '.mat-ripple-element' ) . length ) 
0 commit comments