File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,7 @@ describe('MdSlideToggle', () => {
363363 let testComponent : SlideToggleFormsTestApp ;
364364 let buttonElement : HTMLButtonElement ;
365365 let labelElement : HTMLLabelElement ;
366+ let inputElement : HTMLInputElement ;
366367
367368 // This initialization is async() because it needs to wait for ngModel to set the initial value.
368369 beforeEach ( async ( ( ) => {
@@ -374,9 +375,17 @@ describe('MdSlideToggle', () => {
374375
375376 buttonElement = fixture . debugElement . query ( By . css ( 'button' ) ) . nativeElement ;
376377 labelElement = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
378+ inputElement = fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement ;
377379 } ) ) ;
378380
379- it ( 'should prevent the form from submit when being required' , async ( ( ) => {
381+ it ( 'should prevent the form from submit when being required' , ( ) => {
382+
383+ if ( 'reportValidity' in inputElement === false ) {
384+ // If the browser does not report the validity then the tests will break.
385+ // e.g Safari 8 on Mobile.
386+ return ;
387+ }
388+
380389 testComponent . isRequired = true ;
381390
382391 fixture . detectChanges ( ) ;
@@ -393,7 +402,7 @@ describe('MdSlideToggle', () => {
393402 fixture . detectChanges ( ) ;
394403
395404 expect ( testComponent . isSubmitted ) . toBe ( true ) ;
396- } ) ) ;
405+ } ) ;
397406
398407 } ) ;
399408
You can’t perform that action at this time.
0 commit comments