@@ -2,14 +2,15 @@ import { faker } from "@faker-js/faker";
22import { yupResolver } from "@hookform/resolvers/yup" ;
33import { Form , Input , StaticTypeaheadInput , AsyncTypeaheadInput , DatePickerInput , FormattedInput } from "react-hook-form-components" ;
44import * as yup from "yup" ;
5+ import { mount } from "cypress/react18" ;
56
67it ( "adding * character if string label works" , ( ) => {
78 const name = faker . random . alpha ( 10 ) ;
89 const schema = yup . object ( ) . shape ( {
910 [ name ] : yup . number ( ) ,
1011 } ) ;
1112
12- cy . mount (
13+ mount (
1314 < Form
1415 onSubmit = { ( ) => {
1516 // Nothing to do
@@ -31,7 +32,7 @@ it("ignore * character if label is not of string type works", () => {
3132 [ name ] : yup . number ( ) ,
3233 } ) ;
3334
34- cy . mount (
35+ mount (
3536 < Form
3637 onSubmit = { ( ) => {
3738 // Nothing to do
@@ -61,7 +62,7 @@ it("testing existing * on nested object", () => {
6162 [ fakePerson . city . address . street ] : yup . string ( ) ,
6263 } ) ;
6364
64- cy . mount (
65+ mount (
6566 < Form
6667 onSubmit = { ( ) => {
6768 // Nothing to do
@@ -105,7 +106,7 @@ const ValidationForm = (props: { hideValidationMessage?: boolean; hideValidation
105106} ;
106107
107108it ( "show validation messages" , ( ) => {
108- cy . mount ( < ValidationForm /> ) ;
109+ mount ( < ValidationForm /> ) ;
109110 cy . get ( `button[type=submit]` ) . click ( ) ;
110111 cy . get ( `label[for=name` ) . parent ( ) . find ( ".invalid-feedback" ) . should ( "exist" ) ;
111112 cy . get ( `label[for=surname` ) . parent ( ) . find ( "#surname-helper-text" ) . should ( "exist" ) ;
@@ -115,7 +116,7 @@ it("show validation messages", () => {
115116} ) ;
116117
117118it ( "hide validation messages when hideValidationMessages is provided through the form" , ( ) => {
118- cy . mount ( < ValidationForm hideValidationMessages /> ) ;
119+ mount ( < ValidationForm hideValidationMessages /> ) ;
119120
120121 cy . get ( `button[type=submit]` ) . click ( ) ;
121122 cy . get ( `label[for=name` ) . parent ( ) . find ( ".invalid-feedback" ) . should ( "not.exist" ) ;
@@ -126,7 +127,7 @@ it("hide validation messages when hideValidationMessages is provided through the
126127} ) ;
127128
128129it ( "hide validation message when hideValidationMessage is provided on the single input" , ( ) => {
129- cy . mount ( < ValidationForm hideValidationMessage /> ) ;
130+ mount ( < ValidationForm hideValidationMessage /> ) ;
130131
131132 cy . get ( `button[type=submit]` ) . click ( ) ;
132133 cy . get ( `label[for=name` ) . parent ( ) . find ( ".invalid-feedback" ) . should ( "not.exist" ) ;
0 commit comments