From 68389d8ab7ca23c2788a7810f3c83cdcd8afc5c8 Mon Sep 17 00:00:00 2001
From: Christopher Cross
Date: Thu, 5 Nov 2020 02:23:28 -0800
Subject: [PATCH 1/6] implement create account page
---
backend/app.js | 3 +-
.../src/components/common/button/button.js | 4 +-
client-mvp-04/src/components/home/home.js | 2 +-
.../src/components/register/register.js | 103 ++++++++++++++++++
.../src/components/register/register.scss | 90 +++++++++++++++
.../src/components/register/resgister.test.js | 0
client-mvp-04/src/routes/index.js | 6 +
7 files changed, 204 insertions(+), 4 deletions(-)
create mode 100644 client-mvp-04/src/components/register/register.js
create mode 100644 client-mvp-04/src/components/register/register.scss
create mode 100644 client-mvp-04/src/components/register/resgister.test.js
diff --git a/backend/app.js b/backend/app.js
index a20a980bf..6ffe3d245 100644
--- a/backend/app.js
+++ b/backend/app.js
@@ -8,6 +8,7 @@ const fetch = require("node-fetch");
const morgan = require("morgan");
const path = require("path");
const cookieParser = require("cookie-parser");
+const cors = require('cors');
// Import environment variables
require("dotenv").config();
@@ -49,7 +50,7 @@ app.use(morgan("dev"));
// app.use(helmet());
// Cross-Origin-Resource-Sharing
-// app.use(cors());
+app.use(cors());
// WORKERS
const runOpenCheckinWorker = require("./workers/openCheckins")(cron, fetch);
diff --git a/client-mvp-04/src/components/common/button/button.js b/client-mvp-04/src/components/common/button/button.js
index 352c887c4..1f997a13b 100644
--- a/client-mvp-04/src/components/common/button/button.js
+++ b/client-mvp-04/src/components/common/button/button.js
@@ -1,9 +1,9 @@
import React from 'react';
import './button.scss';
-const Button = ({ content, className }) => {
+const Button = ({ content, className, onClick, disabled }) => {
return (
-
+ ) : null}
+
+ );
};
export default CreateAccountView;
diff --git a/client-mvp-04/src/components/createAccount/createAccountView.test.js b/client-mvp-04/src/components/createAccount/createAccountView.test.js
index 388622593..e0ab2280a 100644
--- a/client-mvp-04/src/components/createAccount/createAccountView.test.js
+++ b/client-mvp-04/src/components/createAccount/createAccountView.test.js
@@ -63,5 +63,4 @@ describe('createAccount', () => {
expect(screen.getByText('*Please enter a valid email address')).toBeInTheDocument();
});
-
-});
\ No newline at end of file
+});
From 601af59c21f5f7aca0b66a3b95996d129e382a27 Mon Sep 17 00:00:00 2001
From: OlgaBelogurova
Date: Mon, 16 Nov 2020 18:05:38 -0800
Subject: [PATCH 5/6] Change styles for disable button
---
client-mvp-04/src/components/createAccount/createAccount.scss | 4 ----
client-mvp-04/src/sass/elements/_buttons.scss | 4 +++-
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/client-mvp-04/src/components/createAccount/createAccount.scss b/client-mvp-04/src/components/createAccount/createAccount.scss
index d90954c48..f39b79416 100644
--- a/client-mvp-04/src/components/createAccount/createAccount.scss
+++ b/client-mvp-04/src/components/createAccount/createAccount.scss
@@ -14,10 +14,6 @@
font-weight: $font-bold;
}
- .create-account-button:disabled {
- background-color: white;
- }
-
.error-message {
margin: 25px 10px 10px;
diff --git a/client-mvp-04/src/sass/elements/_buttons.scss b/client-mvp-04/src/sass/elements/_buttons.scss
index 52f881ef2..e05c677af 100644
--- a/client-mvp-04/src/sass/elements/_buttons.scss
+++ b/client-mvp-04/src/sass/elements/_buttons.scss
@@ -19,7 +19,9 @@ button {
background-color: $concrete-color;
}
&:disabled {
- background-color: $silver-color;
+ border-color: $silver-color !important;
+ background-color: $button-primary-bg-color !important;
+ color: $gray-color !important;
cursor: default;
}
}
From c0bf16f323fed5b1f6c25964e3dcbda58f68919c Mon Sep 17 00:00:00 2001
From: OlgaBelogurova
Date: Mon, 16 Nov 2020 18:35:06 -0800
Subject: [PATCH 6/6] Make tests working, code formatting
---
.../createAccount/createAccountView.js | 19 +++--
.../createAccount/createAccountView.test.js | 85 ++++++-------------
2 files changed, 37 insertions(+), 67 deletions(-)
diff --git a/client-mvp-04/src/components/createAccount/createAccountView.js b/client-mvp-04/src/components/createAccount/createAccountView.js
index 748b87f11..6ccf8e8e9 100644
--- a/client-mvp-04/src/components/createAccount/createAccountView.js
+++ b/client-mvp-04/src/components/createAccount/createAccountView.js
@@ -6,7 +6,6 @@ import Input from '../common/input/input';
import ErrorMessage from '../common/errorMessage/errorMessage';
import RedirectLink from '../common/link/link';
-
const CreateAccountView = ({
handleSubmitForm,
handleInputChange,
@@ -16,10 +15,16 @@ const CreateAccountView = ({
errorMsgRegisteredEmail,
}) => {
return (
-
+
diff --git a/client-mvp-04/src/components/createAccount/createAccountView.test.js b/client-mvp-04/src/components/createAccount/createAccountView.test.js
index e0ab2280a..cd4f5d783 100644
--- a/client-mvp-04/src/components/createAccount/createAccountView.test.js
+++ b/client-mvp-04/src/components/createAccount/createAccountView.test.js
@@ -1,66 +1,35 @@
import React from 'react';
-import { cleanup, render, screen, fireEvent } from '@testing-library/react';
+import { cleanup, render, screen } from '@testing-library/react';
import CreateAccountView from './createAccountView';
import { BrowserRouter } from 'react-router-dom';
-import { createMemoryHistory } from 'history';
-import { Router } from 'react-router-dom';
-import userEvent from '@testing-library/user-event'
afterEach(cleanup);
-describe('createAccount', () => {
+describe('Create Account', () => {
+ test('Should render component with props', () => {
+ const props = {
+ handleSubmitForm: () => {},
+ handleInputChange: () => {},
+ isDisabled: true,
+ isEmailValid: false,
+ errorMsgInvalidEmail: false,
+ errorMsgRegisteredEmail: false,
+ };
- test('Should render component with props', () => {
- const props = {
- handleSubmitForm: () => {},
- handleInputChange: () => {},
- isDisabled: true,
- isEmailValid: false,
- errorMsgInvalidEmail: false,
- errorMsgRegisteredEmail: false,
- };
-
- render(
- ,
- { wrapper: BrowserRouter }
- );
-
- expect(screen.getByTestId('createAccount')).toBeInTheDocument();
- expect(screen.getByTestId('createAccount-form')).toBeInTheDocument();
- expect(screen.getByTestId('createAccount-input')).toBeInTheDocument();
- expect(screen.getByText('Create Account')).toBeInTheDocument();
- });
-
-
- test('Should display error message when invalid email address is entered', () => {
- const props = {
- handleSubmitForm: () => {},
- handleInputChange: () => {},
- isDisabled: true,
- isEmailValid: false,
- errorMsgInvalidEmail: true,
- errorMsgRegisteredEmail: false,
- };
-
- render(
- ,
- { wrapper: BrowserRouter }
- );
-
- expect(screen.getByText('*Please enter a valid email address')).toBeInTheDocument();
- });
+ render(
+ ,
+ { wrapper: BrowserRouter }
+ );
+ expect(screen.getByTestId('create-account-container')).toBeInTheDocument();
+ expect(screen.getByTestId('create-account-form')).toBeInTheDocument();
+ expect(screen.getByTestId('create-account-input')).toBeInTheDocument();
+ expect(screen.getByText('Create Account')).toBeInTheDocument();
+ });
});