From c141c30b068e91f58b0c64649462589f7442a2df Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 1 Feb 2017 16:07:37 -0200 Subject: [#922] Create route for account recovery with @tayanefernandes --- web-ui/app/account_recovery.html | 9 +++++++++ web-ui/app/js/account_recovery.js | 0 web-ui/config/copy-webpack.js | 1 + web-ui/webpack.config.js | 1 + 4 files changed, 11 insertions(+) create mode 100644 web-ui/app/account_recovery.html create mode 100644 web-ui/app/js/account_recovery.js (limited to 'web-ui') diff --git a/web-ui/app/account_recovery.html b/web-ui/app/account_recovery.html new file mode 100644 index 00000000..448f5ea8 --- /dev/null +++ b/web-ui/app/account_recovery.html @@ -0,0 +1,9 @@ + + + + $account_email - Pixelated Account Recovery + + + Hello!!! :) + + diff --git a/web-ui/app/js/account_recovery.js b/web-ui/app/js/account_recovery.js new file mode 100644 index 00000000..e69de29b diff --git a/web-ui/config/copy-webpack.js b/web-ui/config/copy-webpack.js index 79a5de83..1d2d11c1 100644 --- a/web-ui/config/copy-webpack.js +++ b/web-ui/config/copy-webpack.js @@ -4,6 +4,7 @@ module.exports = new CopyWebpackPlugin([ { context: 'app/', from: '404.html' }, { context: 'app/', from: 'index.html' }, { context: 'app/', from: 'sandbox.html' }, + { context: 'app/', from: 'account_recovery.html' }, { context: 'app/', from: 'css/*' }, { context: 'app/', from: 'fonts/*' }, { context: 'app/', from: 'locales/**/*' }, diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index 99162908..720a9a2e 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -6,6 +6,7 @@ var aliases = require('./config/alias-webpack'); module.exports = { entry: { app: './app/js/index.js', + recovery: './app/js/account_recovery.js', sandbox: './app/js/sandbox.js' }, node: { fs: 'empty' }, -- cgit v1.2.3 From 50efd8f59b814bc27e870ff3b09372b0d717b926 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 1 Feb 2017 16:41:11 -0200 Subject: [#922] Add react with @tayanefernandes --- web-ui/app/account_recovery.html | 5 +++-- web-ui/app/js/account_recovery.js | 7 +++++++ web-ui/package.json | 3 +++ web-ui/webpack.config.js | 4 ++-- 4 files changed, 15 insertions(+), 4 deletions(-) (limited to 'web-ui') diff --git a/web-ui/app/account_recovery.html b/web-ui/app/account_recovery.html index 448f5ea8..407f5907 100644 --- a/web-ui/app/account_recovery.html +++ b/web-ui/app/account_recovery.html @@ -1,9 +1,10 @@ - $account_email - Pixelated Account Recovery + Pixelated Account Recovery - Hello!!! :) +
+ diff --git a/web-ui/app/js/account_recovery.js b/web-ui/app/js/account_recovery.js index e69de29b..a136b261 100644 --- a/web-ui/app/js/account_recovery.js +++ b/web-ui/app/js/account_recovery.js @@ -0,0 +1,7 @@ +import React from 'react' +import { render } from 'react-dom' + +render( +

Hello, world!

, + document.getElementById('root') +); diff --git a/web-ui/package.json b/web-ui/package.json index 480dcc55..a41396f7 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -9,6 +9,7 @@ "babel-core": "^6.21.0", "babel-loader": "^6.2.10", "babel-preset-es2015": "^6.18.0", + "babel-preset-react": "^6.22.0", "bower": "1.7.9", "copy-webpack-plugin": "^4.0.1", "dompurify": "^0.8.4", @@ -39,6 +40,8 @@ "minify": "^2.0.13", "modernizr": "^3.3.1", "quoted-printable": "^1.0.1", + "react": "^15.4.2", + "react-dom": "^15.4.2", "requirejs": "2.2.0", "typeahead.js": "^0.11.1", "utf8": "^2.1.2", diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js index 720a9a2e..f0f605b0 100644 --- a/web-ui/webpack.config.js +++ b/web-ui/webpack.config.js @@ -6,7 +6,7 @@ var aliases = require('./config/alias-webpack'); module.exports = { entry: { app: './app/js/index.js', - recovery: './app/js/account_recovery.js', + account_recovery: './app/js/account_recovery.js', sandbox: './app/js/sandbox.js' }, node: { fs: 'empty' }, @@ -25,7 +25,7 @@ module.exports = { test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: 'babel', - query: { presets: ['es2015']} + query: { presets: ['es2015', 'react']} } ] }, -- cgit v1.2.3 From caa8a4fcf7bf7ddd1c78f8c4e60088d72cecb717 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Wed, 1 Feb 2017 18:00:08 -0200 Subject: [#922] Add react tests with @tayanefernandes --- web-ui/.babelrc | 3 +++ web-ui/.jshintignore | 3 +++ web-ui/app/js/account_recovery.js | 3 ++- web-ui/app/js/account_recovery/page.js | 5 +++++ web-ui/karma.conf.js | 2 +- web-ui/package.json | 8 +++++++- web-ui/test/jasmine.json | 9 +++++++++ web-ui/test/spec/account_recovery/account_recovery.spec.js | 11 +++++++++++ web-ui/test/test-main.js | 2 +- 9 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 web-ui/.babelrc create mode 100644 web-ui/app/js/account_recovery/page.js create mode 100644 web-ui/test/jasmine.json create mode 100644 web-ui/test/spec/account_recovery/account_recovery.spec.js (limited to 'web-ui') diff --git a/web-ui/.babelrc b/web-ui/.babelrc new file mode 100644 index 00000000..86c445f5 --- /dev/null +++ b/web-ui/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015", "react"] +} diff --git a/web-ui/.jshintignore b/web-ui/.jshintignore index 6a32b1a4..df04d870 100644 --- a/web-ui/.jshintignore +++ b/web-ui/.jshintignore @@ -2,3 +2,6 @@ app/node_modules app/bower_components app/js/lib app/js/generated +app/js/account_recovery.js +app/js/account_recovery +test/spec/account_recovery diff --git a/web-ui/app/js/account_recovery.js b/web-ui/app/js/account_recovery.js index a136b261..02183574 100644 --- a/web-ui/app/js/account_recovery.js +++ b/web-ui/app/js/account_recovery.js @@ -1,7 +1,8 @@ import React from 'react' import { render } from 'react-dom' +import Page from 'js/account_recovery/page' render( -

Hello, world!

, + , document.getElementById('root') ); diff --git a/web-ui/app/js/account_recovery/page.js b/web-ui/app/js/account_recovery/page.js new file mode 100644 index 00000000..e400dfae --- /dev/null +++ b/web-ui/app/js/account_recovery/page.js @@ -0,0 +1,5 @@ +import React from 'react' + +const Page = () =>

Hello world

; + +export default Page diff --git a/web-ui/karma.conf.js b/web-ui/karma.conf.js index 2895dc42..d10667e9 100644 --- a/web-ui/karma.conf.js +++ b/web-ui/karma.conf.js @@ -68,7 +68,7 @@ module.exports = function (config) { reporters: ['dots', 'junit', 'coverage'], preprocessors: { - 'app/js/!(lib)/**/*.js': ['coverage'] + 'app/js/!(lib|account_recovery)/**/*.js': ['coverage'] }, // enable / disable watching file and executing tests whenever any file changes diff --git a/web-ui/package.json b/web-ui/package.json index a41396f7..52124c54 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -6,6 +6,7 @@ "private": true, "devDependencies": { "babel": "^6.5.2", + "babel-cli": "^6.22.2", "babel-core": "^6.21.0", "babel-loader": "^6.2.10", "babel-preset-es2015": "^6.18.0", @@ -13,6 +14,7 @@ "bower": "1.7.9", "copy-webpack-plugin": "^4.0.1", "dompurify": "^0.8.4", + "enzyme": "^2.7.1", "font-awesome": "^4.7.0", "handlebars": "^4.0.5", "he": "^1.1.0", @@ -22,6 +24,7 @@ "i18next-xhr-backend": "^1.2.1", "iframe-resizer": "^3.5.7", "imagemin": "5.2.1", + "jasmine": "^2.5.3", "jasmine-flight": "^4.0.0", "jasmine-jquery": "^2.1.1", "jquery": "^3.1.1", @@ -41,6 +44,7 @@ "modernizr": "^3.3.1", "quoted-printable": "^1.0.1", "react": "^15.4.2", + "react-addons-test-utils": "^15.4.2", "react-dom": "^15.4.2", "requirejs": "2.2.0", "typeahead.js": "^0.11.1", @@ -49,7 +53,9 @@ "webpack": "^1.14.0" }, "scripts": { - "test": "npm run jshint --silent && npm run build --silent && karma start --single-run $GRUNT_OPTS", + "test": "npm run jshint --silent && npm run build-statics --silent && npm run jasmine-test && npm run karma-test", + "jasmine-test": "babel-node ./node_modules/.bin/jasmine JASMINE_CONFIG_PATH=test/jasmine.json", + "karma-test": "karma start --single-run $GRUNT_OPTS", "debug": "npm run build && karma start --browsers Chrome $GRUNT_OPTS", "watch": "npm run compass-watch & npm run handlebars-watch & npm run build-js-watch", "watch-test": "karma start", diff --git a/web-ui/test/jasmine.json b/web-ui/test/jasmine.json new file mode 100644 index 00000000..969304b6 --- /dev/null +++ b/web-ui/test/jasmine.json @@ -0,0 +1,9 @@ +{ + "spec_dir": "test/spec/account_recovery/", + "spec_files": [ + "**/*[sS]pec.js" + ], + "helpers": [ + "helpers/**/*.js" + ] +} diff --git a/web-ui/test/spec/account_recovery/account_recovery.spec.js b/web-ui/test/spec/account_recovery/account_recovery.spec.js new file mode 100644 index 00000000..d153f0eb --- /dev/null +++ b/web-ui/test/spec/account_recovery/account_recovery.spec.js @@ -0,0 +1,11 @@ +import {shallow} from 'enzyme' +import React from 'react' +import Page from '../../../app/js/account_recovery/page' + +describe('test', () => { + 'use strict'; + it('react', () => { + const page = shallow(); + expect(page.find('h1').text()).toEqual('Hello world'); + }); +}); diff --git a/web-ui/test/test-main.js b/web-ui/test/test-main.js index 4396993f..b7dc430f 100644 --- a/web-ui/test/test-main.js +++ b/web-ui/test/test-main.js @@ -1,7 +1,7 @@ var tests = Object.keys(window.__karma__.files).filter(function (file) { 'use strict'; - return (/\.spec\.js$/.test(file)); + return !(/account_recovery/.test(file)) && (/\.spec\.js$/.test(file)); }); beforeEach(function() { -- cgit v1.2.3 From 93a57dd3daf2312db6de5f138fdde7d7a413e820 Mon Sep 17 00:00:00 2001 From: Anike Arni Date: Thu, 2 Feb 2017 11:46:36 -0200 Subject: [#922] Adds prod webpack configuration for react with @tayanefernandes --- web-ui/webpack.production.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'web-ui') diff --git a/web-ui/webpack.production.config.js b/web-ui/webpack.production.config.js index bddbbe9c..55069c3f 100644 --- a/web-ui/webpack.production.config.js +++ b/web-ui/webpack.production.config.js @@ -6,6 +6,7 @@ var aliases = require('./config/alias-webpack'); module.exports = { entry: { app: './app/js/index.js', + account_recovery: './app/js/account_recovery.js', sandbox: './app/js/sandbox.js' }, node: { fs: 'empty' }, @@ -23,7 +24,7 @@ module.exports = { { test: /\.js$/, loader: 'babel', - query: { presets: ['es2015']} + query: { presets: ['es2015', 'react']} } ] }, -- cgit v1.2.3