diff --git a/.babelrc b/.babelrc index 0afdcb9..985adfb 100644 --- a/.babelrc +++ b/.babelrc @@ -4,6 +4,10 @@ "env": { "development": { "presets": ["react-hmre"] + }, + "test": { + // airbnb some how disables stage-0, so forcing it after airbnb + "presets": ["airbnb", "stage-0"] } } } diff --git a/package.json b/package.json index 3ded895..2a60968 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "intl-format-cache": "^2.0.4", "intl-messageformat": "^1.1.0", "react": "^15.0.0", - "react-dom": "^15.0.0-rc.2", + "react-dom": "^15.0.0", "react-helmet": "^2.3.1", "react-intl": "^2.0.0", "react-motion": "^0.4.0", @@ -38,6 +38,7 @@ "babel-loader": "^6.0.0", "babel-plugin-react-intl": "~2.0.0", "babel-plugin-transform-runtime": "^6.3.13", + "babel-preset-airbnb": "^1.1.1", "babel-preset-es2015": "^6.3.13", "babel-preset-react": "^6.3.13", "babel-preset-react-hmre": "^1.0.1", @@ -47,6 +48,7 @@ "chokidar": "^1.2.0", "css-loader": "^0.23.0", "cssnano": "^3.4.0", + "enzyme": "^2.2.0", "eslint": "^1.10.3", "eslint-plugin-react": "^3.13.1", "exports-loader": "^0.6.3", @@ -54,6 +56,7 @@ "file-loader": "^0.8.5", "html-webpack-plugin": "^1.7.0", "imports-loader": "^0.6.5", + "json-loader": "^0.5.4", "karma": "*", "karma-chai": "*", "karma-es5-shim": "*", @@ -70,7 +73,7 @@ "phantomjs-prebuilt": "^2.0.0", "postcss-loader": "^0.8.0", "postcss-url": "^5.1.1", - "react-addons-test-utils": "^15.0.0", + "react-addons-test-utils": "^15.0.2", "sass-loader": "^3.1.2", "sinon": "^1.15.3", "style-loader": "^0.13.0", diff --git a/src/components/profile/changePassword/ChangePassword.jsx b/src/components/profile/changePassword/ChangePassword.jsx index b0db038..27c9faa 100644 --- a/src/components/profile/changePassword/ChangePassword.jsx +++ b/src/components/profile/changePassword/ChangePassword.jsx @@ -1,61 +1,87 @@ -import React, { Component } from 'react'; +import React, { Component, PropTypes } from 'react'; import { FormattedMessage as Message } from 'react-intl'; import { Link } from 'react-router'; import Helmet from 'react-helmet'; import { LabeledInput, Button } from 'components/ui/Form'; +import FormModel from 'models/Form'; +import { Form } from 'components/ui/Form'; import styles from 'components/profile/profileForm.scss'; import messages from './ChangePassword.messages'; export default class ChangePassword extends Component { - displayName = 'ChangePassword'; + static displayName = 'ChangePassword'; + + static propTypes = { + onSubmit: PropTypes.func.isRequired + }; + + form = new FormModel(); render() { + const {form} = this; + return ( -
- +
+
+ -
-
- - {(pageTitle) => ( -

- - {pageTitle} -

- )} -
+
+
+ + {(pageTitle) => ( +

+ + {pageTitle} +

+ )} +
-
-

- -
- - - -

+
+

+ +
+ + + +

+
+ +
+ +
+ +
+

+ +

+
+ +
+ +
-
- -
- -
-

- -

-
- -
- -
+
- -
-
+ ); } + + onFormSubmit = () => { + this.props.onSubmit(this.form.serialize()); + }; } diff --git a/src/components/profile/passwordRequestForm/PasswordRequestForm.jsx b/src/components/profile/passwordRequestForm/PasswordRequestForm.jsx new file mode 100644 index 0000000..f0f6b36 --- /dev/null +++ b/src/components/profile/passwordRequestForm/PasswordRequestForm.jsx @@ -0,0 +1,43 @@ +import React, { Component, PropTypes } from 'react'; + +import { FormattedMessage as Message } from 'react-intl'; + +import FormModel from 'models/Form'; +import { Form, Button, Input } from 'components/ui/Form'; + +import messages from './PasswordRequestForm.messages'; + +export default class PasswordRequestForm extends Component { + static displayName = 'PasswordRequestForm'; + + static propTypes = { + onSubmit: PropTypes.func.isRequired + }; + + form = new FormModel(); + + render() { + return ( +
+

+ +

+ + +