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', () => {
363
363
let testComponent : SlideToggleFormsTestApp ;
364
364
let buttonElement : HTMLButtonElement ;
365
365
let labelElement : HTMLLabelElement ;
366
+ let inputElement : HTMLInputElement ;
366
367
367
368
// This initialization is async() because it needs to wait for ngModel to set the initial value.
368
369
beforeEach ( async ( ( ) => {
@@ -374,9 +375,17 @@ describe('MdSlideToggle', () => {
374
375
375
376
buttonElement = fixture . debugElement . query ( By . css ( 'button' ) ) . nativeElement ;
376
377
labelElement = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
378
+ inputElement = fixture . debugElement . query ( By . css ( 'input' ) ) . nativeElement ;
377
379
} ) ) ;
378
380
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
+
380
389
testComponent . isRequired = true ;
381
390
382
391
fixture . detectChanges ( ) ;
@@ -393,7 +402,7 @@ describe('MdSlideToggle', () => {
393
402
fixture . detectChanges ( ) ;
394
403
395
404
expect ( testComponent . isSubmitted ) . toBe ( true ) ;
396
- } ) ) ;
405
+ } ) ;
397
406
398
407
} ) ;
399
408
You can’t perform that action at this time.
0 commit comments