Skip to content
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

Merged
merged 10 commits into from
Dec 17, 2017
Merged

Use formik for login and sign up forms #235

merged 10 commits into from
Dec 17, 2017

Conversation

phyrog
Copy link
Contributor

@phyrog phyrog commented Dec 6, 2017

Closes #161.

I had to remove some tests for the SignInForm and SignUpForm 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.

captcha.execute();
}
if (!enableCaptcha) {
console.error("Ok");

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);

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";

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";

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";

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
Copy link

codecov bot commented Dec 6, 2017

Codecov Report

Merging #235 into master will increase coverage by 1.42%.
The diff coverage is 95.38%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/components/LoginModal.js 100% <100%> (ø) ⬆️
src/components/SignUpForm/Field.js 100% <100%> (ø)
src/components/GlobalMenu.js 100% <100%> (ø) ⬆️
src/components/SignUpForm/PasswordStrengthBar.js 100% <100%> (ø)
src/components/SignInForm.js 100% <100%> (ø) ⬆️
src/components/SignUpForm/index.js 100% <100%> (ø)
src/components/SignUpForm/withRefs.js 83.33% <83.33%> (ø)
src/components/SignUpForm/validation.js 95.45% <95.45%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3a96fad...717f014. Read the comment docs.

@phyrog phyrog force-pushed the formik branch 2 times, most recently from edef986 to 3bb6698 Compare December 6, 2017 12:47
@phyrog
Copy link
Contributor Author

phyrog commented Dec 11, 2017

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";

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";

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";

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))) {

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

Copy link
Contributor Author

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.

Copy link
Member

@eugenk eugenk Dec 13, 2017

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

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 {

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 } }) => {

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 => {

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";

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";

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

@phyrog phyrog force-pushed the formik branch 2 times, most recently from 2aeeb5c to 25a965a Compare December 13, 2017 13:44
Copy link
Member

@eugenk eugenk left a 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.

touched,
values
}) => (
<Form onSubmit={!submitDisabled ? onSubmit : undefined}>
Copy link
Member

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

@phyrog
Copy link
Contributor Author

phyrog commented Dec 17, 2017

I rebased on master and added commit 717f014 to address the review.

Copy link
Member

@eugenk eugenk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phyrog phyrog merged commit 3a81a19 into master Dec 17, 2017
@phyrog phyrog deleted the formik branch December 17, 2017 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants