@@ -50,7 +50,7 @@ describe('FormField - Tests', () => {
50
50
mount ( < FormField { ...props } /> )
51
51
cy . get ( '#lbl_optionalDate' ) . contains ( 'Optional Date' )
52
52
cy . get ( '#lbl_optionalDate' ) . should ( 'not.contain' , '*' )
53
- cy . get ( 'input' ) . type ( '{end}{del}99 ' )
53
+ cy . get ( 'input' ) . type ( '{end}{del}9999 ' )
54
54
cy . get ( '.formField-optionalDate .error-message' ) . contains ( FormValidators . DATEJS . msg )
55
55
} )
56
56
it ( 'should render a calendar picker control initialized with an error' , ( ) => {
@@ -827,14 +827,17 @@ describe('FormField - Tests', () => {
827
827
it ( 'should not allow mounting if unknown prop' , ( done ) => {
828
828
// this event will automatically be unbound when this
829
829
// test ends because it's attached to 'cy'
830
+ let called = false
830
831
cy . on ( 'uncaught:exception' , ( err ) => {
832
+ if ( ! called ) {
831
833
// ensure the error is about an unknown field
832
- expect ( err . message ) . to . include ( 'unknown' )
833
-
834
- // using mocha's async done callback to finish
835
- // this test so we prove that an uncaught exception
836
- // was thrown
837
- done ( )
834
+ expect ( err . message ) . to . include ( 'unknown' )
835
+ called = true
836
+ // using mocha's async done callback to finish
837
+ // this test so we prove that an uncaught exception
838
+ // was thrown
839
+ done ( )
840
+ }
838
841
839
842
// return false to prevent the error from
840
843
// failing this test
@@ -850,9 +853,13 @@ describe('FormField - Tests', () => {
850
853
} )
851
854
852
855
it ( 'errors if required prop not given' , ( done ) => {
856
+ let called = false
853
857
cy . on ( 'uncaught:exception' , ( err ) => {
854
- expect ( err . message ) . to . include ( 'id' )
855
- done ( )
858
+ if ( ! called ) {
859
+ expect ( err . message ) . to . include ( 'id' )
860
+ called = true
861
+ done ( )
862
+ }
856
863
return false
857
864
} )
858
865
@@ -865,9 +872,13 @@ describe('FormField - Tests', () => {
865
872
} )
866
873
867
874
it ( 'errors based on custom validation' , ( done ) => {
875
+ let called = false
868
876
cy . on ( 'uncaught:exception' , ( err ) => {
869
- expect ( err . message ) . to . include ( 'example failure' )
870
- done ( )
877
+ if ( ! called ) {
878
+ expect ( err . message ) . to . include ( 'example failure' )
879
+ called = true
880
+ done ( )
881
+ }
871
882
return false
872
883
} )
873
884
0 commit comments