-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use formik for login and sign up forms #235
Conversation
src/components/SignUpForm/index.js
Outdated
captcha.execute(); | ||
} | ||
if (!enableCaptcha) { | ||
console.error("Ok"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected console statement no-console
formik.js
Outdated
import { size } from "lodash"; | ||
|
||
function submitForm(values) { | ||
console.log(values); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected console statement no-console
formik.js
Outdated
import "./App.css"; | ||
import { Formik } from "formik"; | ||
import ReCAPTCHA from "react-google-recaptcha"; | ||
import { size } from "lodash"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'size' is defined but never used no-unused-vars
formik.js
Outdated
@@ -0,0 +1,51 @@ | |||
import React, { Component } from "react"; | |||
import logo from "./logo.svg"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'logo' is defined but never used no-unused-vars
formik.js
Outdated
@@ -0,0 +1,51 @@ | |||
import React, { Component } from "react"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Component' is defined but never used no-unused-vars
Codecov Report
@@ Coverage Diff @@
## master #235 +/- ##
==========================================
+ Coverage 96.15% 97.58% +1.42%
==========================================
Files 11 14 +3
Lines 156 124 -32
Branches 22 11 -11
==========================================
- Hits 150 121 -29
+ Misses 5 3 -2
+ Partials 1 0 -1
Continue to review full report at Codecov.
|
edef986
to
3bb6698
Compare
I'm currently reworking this to be better testable. Not ready for review yet. |
|
||
import { ThemeProvider } from "styled-components"; | ||
import theme from "../../styles"; | ||
import { Icon, Input, Header as SemHeader, Menu } from "semantic-ui-react"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Icon' is defined but never used no-unused-vars
'Input' is defined but never used no-unused-vars
'SemHeader' is defined but never used no-unused-vars
'Menu' is defined but never used no-unused-vars
import { action } from "@storybook/addon-actions"; | ||
|
||
import { ThemeProvider } from "styled-components"; | ||
import theme from "../../styles"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'theme' is defined but never used no-unused-vars
import { storiesOf } from "@storybook/react"; | ||
import { action } from "@storybook/addon-actions"; | ||
|
||
import { ThemeProvider } from "styled-components"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'ThemeProvider' is defined but never used no-unused-vars
let matches; | ||
let regex = /GraphQL error:\s*((\S+) .+)\s*$/gm; | ||
|
||
while ((matches = regex.exec(err.message))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected assignment within a 'while' statement no-cond-assign
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wanted in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, let's use
// eslint-disable-next-line no-cond-assign
while ((matches = regex.exec(err.message))) {
forEach, | ||
compact, | ||
capitalize, | ||
trim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'trim' is defined but never used no-unused-vars
} | ||
})); | ||
|
||
import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import in body of module; reorder to top import/first
@@ -0,0 +1,139 @@ | |||
jest.mock("../../../apollo", () => ({ | |||
Client: { | |||
query: ({ variables: { id: id } }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Destructuring assignment id unnecessarily renamed no-useless-rename
"#sign-up-email", | ||
"#sign-up-password", | ||
"#sign-up-password-confirm" | ||
].map(selector => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected to return a value in arrow function array-callback-return
@@ -0,0 +1,111 @@ | |||
import React from "react"; | |||
import { shallow, mount } from "enzyme"; | |||
import _ from "lodash"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'_' is defined but never used no-unused-vars
@@ -0,0 +1,111 @@ | |||
import React from "react"; | |||
import { shallow, mount } from "enzyme"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'shallow' is defined but never used no-unused-vars
2aeeb5c
to
25a965a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and my earlier hound-related comment.
src/components/SignUpForm/index.js
Outdated
touched, | ||
values | ||
}) => ( | ||
<Form onSubmit={!submitDisabled ? onSubmit : undefined}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it more readable with one less negation? ;)
submitDisabled ? undefined : onSubmit
or even:
submitEnabled ? onSubmit : undefined
I rebased on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closes #161.
I had to remove some tests for the
SignInForm
andSignUpForm
as I couldn't find any way on how to wait for validation/submission to finish to check the changes in output. This happens all asynchronously and I don't have access to the Promises, so I'm out of ideas here.