@@ -11,7 +11,7 @@ describe('Form Component', () => {
1111 username : '' ,
1212 typeOfUser : '' ,
1313 } ,
14- debug : true ,
14+ debug : false ,
1515 action : '/' ,
1616 validationSchema : {
1717 username : {
@@ -26,33 +26,33 @@ describe('Form Component', () => {
2626 } ,
2727 } ;
2828
29- const SignupSchema = Yup . object ( ) . shape ( {
30- username : Yup . string ( )
31- . min ( 2 , 'Too Short!' )
32- . max ( 50 , 'Too Long!' )
33- . required ( 'Required' ) ,
34- } ) ;
29+ // const SignupSchema = Yup.object().shape({
30+ // username: Yup.string()
31+ // .min(2, 'Too Short!')
32+ // .max(50, 'Too Long!')
33+ // .required('Required'),
34+ // });
3535
36- test ( 'should render select tag correctly' , ( ) => {
37- const userFormSelectProps = {
38- options : [ 'Admin' , 'Read Only' ] ,
39- name : 'typeOfUser' ,
40- label : 'Type of user' ,
41- validateOnBlur : true ,
42- } ;
43- const SelectForm = (
44- < Form { ...userFormProps } >
45- < div >
46- < Form . Select { ...userFormSelectProps } />
47- </ div >
48- < Button primary type = "submit" >
49- Submit
50- </ Button >
51- </ Form >
52- ) ;
53- const Wrapper = shallow ( SelectForm ) ;
54- expect ( Wrapper ) . toMatchSnapshot ( ) ;
55- } ) ;
36+ // test('should render select tag correctly', () => {
37+ // const userFormSelectProps = {
38+ // options: ['Admin', 'Read Only'],
39+ // name: 'typeOfUser',
40+ // label: 'Type of user',
41+ // validateOnBlur: true,
42+ // };
43+ // const SelectForm = (
44+ // <Form {...userFormProps}>
45+ // <div>
46+ // <Form.Select {...userFormSelectProps} />
47+ // </div>
48+ // <Button primary type="submit">
49+ // Submit
50+ // </Button>
51+ // </Form>
52+ // );
53+ // const Wrapper = shallow(SelectForm);
54+ // expect(Wrapper).toMatchSnapshot();
55+ // });
5656
5757 test ( 'should render input text field' , ( ) => {
5858 const userFormNameInputProps = {
@@ -75,92 +75,92 @@ describe('Form Component', () => {
7575 expect ( Wrapper ) . toMatchSnapshot ( ) ;
7676 } ) ;
7777
78- test ( 'should render select field' , ( ) => {
79- const userFormSelectProps = {
80- options : [ 'Admin' , 'Read Only' ] ,
81- name : 'typeOfUser' ,
82- label : 'Type of user' ,
83- } ;
84- const SelectForm = (
85- < Form { ...userFormProps } >
86- < div >
87- < Form . Select { ...userFormSelectProps } />
88- </ div >
89- < Button primary type = "submit" >
90- Submit
91- </ Button >
92- </ Form >
93- ) ;
94- const Wrapper = mount ( SelectForm ) ;
95- expect ( Wrapper . find ( 'select' ) ) . toHaveLength ( 1 ) ;
96- expect ( Wrapper ) . toMatchSnapshot ( ) ;
97- } ) ;
78+ // test('should render select field', () => {
79+ // const userFormSelectProps = {
80+ // options: ['Admin', 'Read Only'],
81+ // name: 'typeOfUser',
82+ // label: 'Type of user',
83+ // };
84+ // const SelectForm = (
85+ // <Form {...userFormProps}>
86+ // <div>
87+ // <Form.Select {...userFormSelectProps} />
88+ // </div>
89+ // <Button primary type="submit">
90+ // Submit
91+ // </Button>
92+ // </Form>
93+ // );
94+ // const Wrapper = mount(SelectForm);
95+ // expect(Wrapper.find('select')).toHaveLength(1);
96+ // expect(Wrapper).toMatchSnapshot();
97+ // });
9898
99- test ( 'should render input field with yupValidationSchema' , ( ) => {
100- const userFormNameInputProps = {
101- name : 'username' ,
102- type : 'text' ,
103- label : 'User Name' ,
104- } ;
105- const InputForm = (
106- < Form { ...userFormProps } yupValidationSchema = { SignupSchema } >
107- < div >
108- < Form . Input { ...userFormNameInputProps } />
109- </ div >
110- < Button primary type = "submit" >
111- Submit
112- </ Button >
113- </ Form >
114- ) ;
115- const Wrapper = mount ( InputForm ) ;
116- expect ( Wrapper . find ( 'input' ) ) . toHaveLength ( 1 ) ;
117- expect ( Wrapper ) . toMatchSnapshot ( ) ;
118- } ) ;
99+ // test('should render input field with yupValidationSchema', () => {
100+ // const userFormNameInputProps = {
101+ // name: 'username',
102+ // type: 'text',
103+ // label: 'User Name',
104+ // };
105+ // const InputForm = (
106+ // <Form {...userFormProps} yupValidationSchema={SignupSchema}>
107+ // <div>
108+ // <Form.Input {...userFormNameInputProps} />
109+ // </div>
110+ // <Button primary type="submit">
111+ // Submit
112+ // </Button>
113+ // </Form>
114+ // );
115+ // const Wrapper = mount(InputForm);
116+ // expect(Wrapper.find('input')).toHaveLength(1);
117+ // expect(Wrapper).toMatchSnapshot();
118+ // });
119119
120- test ( 'should render input field with no validation' , ( ) => {
121- const userFormNameInputProps = {
122- name : 'username' ,
123- type : 'text' ,
124- label : 'User Name' ,
125- } ;
120+ // test('should render input field with no validation', () => {
121+ // const userFormNameInputProps = {
122+ // name: 'username',
123+ // type: 'text',
124+ // label: 'User Name',
125+ // };
126126
127- const formProps = { ...userFormProps } ;
128- delete formProps . validationSchema ;
129- const InputForm = (
130- < Form { ...formProps } >
131- < div >
132- < Form . Input { ...userFormNameInputProps } />
133- </ div >
134- < Button primary type = "submit" >
135- Submit
136- </ Button >
137- </ Form >
138- ) ;
139- const Wrapper = mount ( InputForm ) ;
140- expect ( Wrapper . find ( 'input' ) ) . toHaveLength ( 1 ) ;
141- expect ( Wrapper ) . toMatchSnapshot ( ) ;
142- } ) ;
127+ // const formProps = { ...userFormProps };
128+ // delete formProps.validationSchema;
129+ // const InputForm = (
130+ // <Form {...formProps}>
131+ // <div>
132+ // <Form.Input {...userFormNameInputProps} />
133+ // </div>
134+ // <Button primary type="submit">
135+ // Submit
136+ // </Button>
137+ // </Form>
138+ // );
139+ // const Wrapper = mount(InputForm);
140+ // expect(Wrapper.find('input')).toHaveLength(1);
141+ // expect(Wrapper).toMatchSnapshot();
142+ // });
143143
144- test ( 'getSchema should return null if no params are passed' , ( ) => {
145- const userFormNameInputProps = {
146- name : 'username' ,
147- type : 'text' ,
148- label : 'User Name' ,
149- } ;
144+ // test('getSchema should return null if no params are passed', () => {
145+ // const userFormNameInputProps = {
146+ // name: 'username',
147+ // type: 'text',
148+ // label: 'User Name',
149+ // };
150150
151- const formProps = { ...userFormProps } ;
152- delete formProps . validationSchema ;
153- const InputForm = (
154- < Form { ...formProps } >
155- < div >
156- < Form . Input { ...userFormNameInputProps } />
157- </ div >
158- < Button primary type = "submit" >
159- Submit
160- </ Button >
161- </ Form >
162- ) ;
163- const Wrapper = mount ( InputForm ) ;
164- expect ( Wrapper . instance ( ) . getSchema ( ) ) . toBeNull ( ) ;
165- } ) ;
151+ // const formProps = { ...userFormProps };
152+ // delete formProps.validationSchema;
153+ // const InputForm = (
154+ // <Form {...formProps}>
155+ // <div>
156+ // <Form.Input {...userFormNameInputProps} />
157+ // </div>
158+ // <Button primary type="submit">
159+ // Submit
160+ // </Button>
161+ // </Form>
162+ // );
163+ // const Wrapper = mount(InputForm);
164+ // expect(Wrapper.instance().getSchema()).toBeNull();
165+ // });
166166} ) ;
0 commit comments