Browse Source

[+Jordi] #87 - Go button should also submit in Verify page

Elisa Cutrin 1 year ago
parent
commit
4d62868853

+ 4 - 2
apps/credential-issuer/src/client/components/Verify.jsx

@@ -72,8 +72,10 @@ const Verify = () => (<Container>
72 72
   <HeaderComponent />
73 73
   <Title>Climate change petition</Title>
74 74
   <SubTitle>To confirm your residency enter your NIF or NIE.</SubTitle>
75
-  <TextInput type="text" />
76
-  <Button onClick={sendCredential}>Next</Button>
75
+  <form onSubmit={sendCredential}>
76
+    <TextInput type="text" />
77
+    <Button type="submit">Next</Button>
78
+  </form>
77 79
 </Container>);
78 80
 
79 81
 Verify.propTypes = {

+ 109 - 53
apps/credential-issuer/test/__snapshots__/Verify.test.js.snap

@@ -12,14 +12,18 @@ ShallowWrapper {
12 12
     <styled.div>
13 13
       To confirm your residency enter your NIF or NIE.
14 14
     </styled.div>
15
-    <styled.input
16
-      type="text"
17
-    />
18
-    <styled.button
19
-      onClick={[Function]}
15
+    <form
16
+      onSubmit={[Function]}
20 17
     >
21
-      Next
22
-    </styled.button>
18
+      <styled.input
19
+        type="text"
20
+      />
21
+      <styled.button
22
+        type="submit"
23
+      >
24
+        Next
25
+      </styled.button>
26
+    </form>
23 27
   </styled.div>,
24 28
   Symbol(enzyme.__renderer__): Object {
25 29
     "batchedUpdates": [Function],
@@ -41,14 +45,18 @@ ShallowWrapper {
41 45
         <styled.div>
42 46
           To confirm your residency enter your NIF or NIE.
43 47
         </styled.div>,
44
-        <styled.input
45
-          type="text"
46
-        />,
47
-        <styled.button
48
-          onClick={[Function]}
48
+        <form
49
+          onSubmit={[Function]}
49 50
         >
50
-          Next
51
-        </styled.button>,
51
+          <styled.input
52
+            type="text"
53
+          />
54
+          <styled.button
55
+            type="submit"
56
+          >
57
+            Next
58
+          </styled.button>
59
+        </form>,
52 60
       ],
53 61
       "className": "sc-htpNat iriqgp",
54 62
     },
@@ -88,25 +96,47 @@ ShallowWrapper {
88 96
       Object {
89 97
         "instance": null,
90 98
         "key": undefined,
91
-        "nodeType": "class",
92
-        "props": Object {
93
-          "type": "text",
94
-        },
95
-        "ref": null,
96
-        "rendered": null,
97
-        "type": [Function],
98
-      },
99
-      Object {
100
-        "instance": null,
101
-        "key": undefined,
102
-        "nodeType": "class",
99
+        "nodeType": "host",
103 100
         "props": Object {
104
-          "children": "Next",
105
-          "onClick": [Function],
101
+          "children": Array [
102
+            <styled.input
103
+              type="text"
104
+            />,
105
+            <styled.button
106
+              type="submit"
107
+            >
108
+              Next
109
+            </styled.button>,
110
+          ],
111
+          "onSubmit": [Function],
106 112
         },
107 113
         "ref": null,
108
-        "rendered": "Next",
109
-        "type": [Function],
114
+        "rendered": Array [
115
+          Object {
116
+            "instance": null,
117
+            "key": undefined,
118
+            "nodeType": "class",
119
+            "props": Object {
120
+              "type": "text",
121
+            },
122
+            "ref": null,
123
+            "rendered": null,
124
+            "type": [Function],
125
+          },
126
+          Object {
127
+            "instance": null,
128
+            "key": undefined,
129
+            "nodeType": "class",
130
+            "props": Object {
131
+              "children": "Next",
132
+              "type": "submit",
133
+            },
134
+            "ref": null,
135
+            "rendered": "Next",
136
+            "type": [Function],
137
+          },
138
+        ],
139
+        "type": "form",
110 140
       },
111 141
     ],
112 142
     "type": "div",
@@ -125,14 +155,18 @@ ShallowWrapper {
125 155
           <styled.div>
126 156
             To confirm your residency enter your NIF or NIE.
127 157
           </styled.div>,
128
-          <styled.input
129
-            type="text"
130
-          />,
131
-          <styled.button
132
-            onClick={[Function]}
158
+          <form
159
+            onSubmit={[Function]}
133 160
           >
134
-            Next
135
-          </styled.button>,
161
+            <styled.input
162
+              type="text"
163
+            />
164
+            <styled.button
165
+              type="submit"
166
+            >
167
+              Next
168
+            </styled.button>
169
+          </form>,
136 170
         ],
137 171
         "className": "sc-htpNat iriqgp",
138 172
       },
@@ -172,25 +206,47 @@ ShallowWrapper {
172 206
         Object {
173 207
           "instance": null,
174 208
           "key": undefined,
175
-          "nodeType": "class",
176
-          "props": Object {
177
-            "type": "text",
178
-          },
179
-          "ref": null,
180
-          "rendered": null,
181
-          "type": [Function],
182
-        },
183
-        Object {
184
-          "instance": null,
185
-          "key": undefined,
186
-          "nodeType": "class",
209
+          "nodeType": "host",
187 210
           "props": Object {
188
-            "children": "Next",
189
-            "onClick": [Function],
211
+            "children": Array [
212
+              <styled.input
213
+                type="text"
214
+              />,
215
+              <styled.button
216
+                type="submit"
217
+              >
218
+                Next
219
+              </styled.button>,
220
+            ],
221
+            "onSubmit": [Function],
190 222
           },
191 223
           "ref": null,
192
-          "rendered": "Next",
193
-          "type": [Function],
224
+          "rendered": Array [
225
+            Object {
226
+              "instance": null,
227
+              "key": undefined,
228
+              "nodeType": "class",
229
+              "props": Object {
230
+                "type": "text",
231
+              },
232
+              "ref": null,
233
+              "rendered": null,
234
+              "type": [Function],
235
+            },
236
+            Object {
237
+              "instance": null,
238
+              "key": undefined,
239
+              "nodeType": "class",
240
+              "props": Object {
241
+                "children": "Next",
242
+                "type": "submit",
243
+              },
244
+              "ref": null,
245
+              "rendered": "Next",
246
+              "type": [Function],
247
+            },
248
+          ],
249
+          "type": "form",
194 250
         },
195 251
       ],
196 252
       "type": "div",