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 @@ -349,6 +349,7 @@ describe('MdSlideToggle', () => {
349349 let testComponent : SlideToggleFormsTestApp ;
350350 let buttonElement : HTMLButtonElement ;
351351 let labelElement : HTMLLabelElement ;
352+ let inputElement : HTMLInputElement ;
352353
353354 // This initialization is async() because it needs to wait for ngModel to set the initial value.
354355 beforeEach ( async ( ( ) => {
@@ -360,9 +361,17 @@ describe('MdSlideToggle', () => {
360361
361362 buttonElement = fixture . debugElement . query ( By . css ( 'button' ) ) . nativeElement ;
362363 labelElement = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
364+ inputElement = fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement ;
363365 } ) ) ;
364366
365- it ( 'should prevent the form from submit when being required' , async ( ( ) => {
367+ it ( 'should prevent the form from submit when being required' , ( ) => {
368+
369+ if ( 'reportValidity' in inputElement === false ) {
370+ // If the browser does not report the validity then the tests will break.
371+ // e.g Safari 8 on Mobile.
372+ return ;
373+ }
374+
366375 testComponent . isRequired = true ;
367376
368377 fixture . detectChanges ( ) ;
@@ -379,7 +388,7 @@ describe('MdSlideToggle', () => {
379388 fixture . detectChanges ( ) ;
380389
381390 expect ( testComponent . isSubmitted ) . toBe ( true ) ;
382- } ) ) ;
391+ } ) ;
383392
384393 } ) ;
385394
You can’t perform that action at this time.
0 commit comments