Skip to content

Commit

Permalink
Merge 7445205 into b1349da
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivekrajput20 committed Jul 29, 2019
2 parents b1349da + 7445205 commit 69f6eb3
Show file tree
Hide file tree
Showing 27 changed files with 1,360 additions and 421 deletions.
65 changes: 33 additions & 32 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
{
"extends": [
"airbnb",
"prettier",
"prettier/react",
"jest-enzyme",
"plugin:jest/recommended"
],
"parser": "babel-eslint",
"plugins": ["prettier", "jest"],
"parserOptions": {
"ecmaVersion": 2016,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"es6": true,
"browser": true,
"node": true
},
"rules": {
"array-bracket-spacing": [2, "never"],
"semi": [2, "always"],
"react/prefer-stateless-function": [0],
"react/jsx-filename-extension": [
1,
{
"extensions": [".js", ".jsx"]
}
]
}
"extends": [
"airbnb",
"prettier",
"prettier/react",
"jest-enzyme",
"plugin:jest/recommended"
],
"parser": "babel-eslint",
"plugins": ["prettier", "jest"],
"parserOptions": {
"ecmaVersion": 2016,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"es6": true,
"browser": true,
"node": true
},
"rules": {
"array-bracket-spacing": [2, "never"],
"semi": [2, "always"],
"jsx-a11y/label-has-for": 0,
"react/prefer-stateless-function": [0],
"react/jsx-filename-extension": [
1,
{
"extensions": [".js", ".jsx"]
}
]
}
}
1 change: 1 addition & 0 deletions client/assets/default/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* */
12 changes: 5 additions & 7 deletions client/components/footer/__snapshots__/footer.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ exports[`<Footer /> rendering should render correctly 1`] = `
<a
className="owisp-footer-link
owisp-footer-link-1"
href="www.testurl.com"
href="https://link-1.com"
rel="noreferrer noopener"
target="_blank"
>
link one
link-1
</a>
<a
className="owisp-footer-link
owisp-footer-link-2"
href="www.testurl2.com"
href="https://link-2.com"
rel="noreferrer noopener"
target="_blank"
>
link two
link-2
</a>
</div>
</div>
Expand All @@ -35,9 +35,7 @@ exports[`<Footer /> rendering should render correctly 1`] = `
>
<div
className="owisp-footer-row-2-inner"
>
this is secondary text
</div>
/>
</div>
</div>
`;
31 changes: 12 additions & 19 deletions client/components/footer/footer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,14 @@ import {shallow} from "enzyme";
import React from "react";
import renderer from "react-test-renderer";

import getConfig from "../../utils/get-config";
import Footer from "./footer";

const defaultConfig = getConfig("default");
const createTestProps = props => {
return {
language: "en",
footer: {
links: [
{
text: {en: "link one"},
url: "www.testurl.com",
},
{
text: {en: "link two"},
url: "www.testurl2.com",
},
],
secondary_text: {
en: "this is secondary text",
},
},
footer: defaultConfig.components.footer,
...props,
};
};
Expand All @@ -48,9 +36,14 @@ describe("<Footer /> rendering", () => {
expect(wrapper.find(".owisp-footer-link")).toHaveLength(0);
});
it("should render secondary text", () => {
const {secondary_text} = props.footer;
expect(wrapper.find(".owisp-footer-row-2-inner").text()).toBe(
secondary_text.en,
);
wrapper.setProps({
footer: {...props.footer, secondary_text: {en: "secondary text"}},
});
expect(
wrapper
.update()
.find(".owisp-footer-row-2-inner")
.text(),
).toBe("secondary text");
});
});
8 changes: 4 additions & 4 deletions client/components/header/__snapshots__/header.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ exports[`<Header /> rendering should render with links 1`] = `
<a
className="owisp-header-link
owisp-header-link-1"
href="https://testlink1.com"
href="https://link-1.com"
rel="noreferrer noopener"
target="_blank"
>
test link 1
link-1
</a>
<a
className="owisp-header-link
owisp-header-link-2"
href="https://testlink2.com"
href="https://link-2.com"
rel="noreferrer noopener"
target="_blank"
>
test link 2
link-2
</a>
</div>
</div>
Expand Down
13 changes: 8 additions & 5 deletions client/components/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "./index.css";

import PropTypes from "prop-types";
import React from "react";
import {Link} from "react-router-dom";

import getAssetPath from "../../utils/get-asset-path";
import getText from "../../utils/get-text";
Expand All @@ -18,11 +19,13 @@ export default class Header extends React.Component {
<div className="owisp-header-left">
<div className="owisp-header-logo-div">
{logo.url ? (
<img
src={getAssetPath(orgSlug, logo.url)}
alt={logo.alternate_text}
className="owisp-header-logo-image"
/>
<Link to={`/${orgSlug}`}>
<img
src={getAssetPath(orgSlug, logo.url)}
alt={logo.alternate_text}
className="owisp-header-logo-image"
/>
</Link>
) : null}
</div>
</div>
Expand Down
23 changes: 3 additions & 20 deletions client/components/header/header.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,17 @@ import {shallow} from "enzyme";
import React from "react";
import renderer from "react-test-renderer";

import getConfig from "../../utils/get-config";
import Header from "./header";

const defaultConfig = getConfig("default");
const createTestProps = props => {
return {
setLanguage: jest.fn(),
orgSlug: "default",
language: "en",
languages: [{slug: "en", text: "english"}, {slug: "it", text: "italian"}],
header: {
logo: {
alternate_text: null,
url: null,
},
links: [
{
text: {
en: "test link 1",
},
url: "https://testlink1.com",
},
{
text: {
en: "test link 2",
},
url: "https://testlink2.com",
},
],
},
header: defaultConfig.components.header,
...props,
};
};
Expand Down
130 changes: 130 additions & 0 deletions client/components/login/__snapshots__/login.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<Login /> rendering should render correctly 1`] = `
<div
className="owisp-login-container"
>
<form
className="owisp-login-form"
onSubmit={[Function]}
>
<div
className="owisp-login-header"
>
<div
className="owisp-login-header-content"
>
sign in
</div>
</div>
<div
className="owisp-login-fieldset"
>
<label
className="owisp-login-label owisp-login-label-username"
htmlFor="owisp-login-username"
>
<div
className="owisp-login-label-text"
>
username
</div>
<input
className="owisp-login-input
owisp-login-input-username
"
id="owisp-login-username"
name="username"
onChange={[Function]}
pattern="[a-zA-Z@.+\\\\-_\\\\d]{1,150}"
placeholder="enter username"
required={true}
title="only letters, numbers, and @/./+/-/_ characters"
type="text"
value=""
/>
</label>
<label
className="owisp-login-label owisp-login-label-password"
htmlFor="owisp-login-password"
>
<div
className="owisp-login-label-text"
>
password
</div>
<input
className="owisp-login-input owisp-login-input-password
"
id="owisp-login-password"
name="password"
onChange={[Function]}
pattern=".{6,}"
placeholder="password"
required={true}
title="password must be a minimum of 6 characters"
type="password"
value=""
/>
</label>
</div>
<div
className="owisp-login-add-info"
>
By logging in, you accept the
<a
className="owisp-login-additional-link"
href="/default/login/terms-and-conditions"
onClick={[Function]}
>
terms and conditions
</a>
and the
<a
className="owisp-login-additional-link"
href="/default/login/privacy-policy"
onClick={[Function]}
>
privacy policy
</a>
of this WiFi service.
</div>
<input
className="owisp-login-form-btn owisp-login-login-btn"
id="owisp-login-login-btn"
type="submit"
value="sign in"
/>
<hr
className="owisp-login-social-hr"
data-content="OR"
/>
<div
className="owisp-login-divider-description"
>
login with
</div>
<div
className="owisp-login-social-links-div"
/>
<div
className="owisp-login-links-div"
>
<a
className="owisp-login-link"
href="/default/password/reset"
onClick={[Function]}
>
Forgot your password?
</a>
<a
className="owisp-login-link"
href="/default/registration"
onClick={[Function]}
>
Not registered yet? Create an account
</a>
</div>
</form>
</div>
`;
Loading

0 comments on commit 69f6eb3

Please sign in to comment.