summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTayane Fernandes <tayane.rmf@gmail.com>2017-02-07 17:39:09 -0200
committerTayane Fernandes <tayane.rmf@gmail.com>2017-02-07 17:39:09 -0200
commitbc922deb23a72d6ca1bf4c39efd1d7366baa9a84 (patch)
treeadf216625b4fb30c79e7577c990ac669da73c204
parentebd5b3adce44a16213e5c1ec763a642899eba908 (diff)
[#922] Refactoring react folder structure
with @anikarni
-rw-r--r--web-ui/.jshintignore5
-rw-r--r--web-ui/config/alias-webpack.js1
-rw-r--r--web-ui/config/copy-webpack.js2
-rw-r--r--web-ui/karma.conf.js2
-rw-r--r--web-ui/package.json3
-rw-r--r--web-ui/src/account_recovery/account_recovery.html (renamed from web-ui/app/account_recovery.html)0
-rw-r--r--web-ui/src/account_recovery/account_recovery.js (renamed from web-ui/app/js/account_recovery.js)4
-rw-r--r--web-ui/src/account_recovery/page.js (renamed from web-ui/app/js/account_recovery/page.js)2
-rw-r--r--web-ui/src/account_recovery/page.scss (renamed from web-ui/app/scss/account_recovery/page.scss)10
-rw-r--r--web-ui/src/i18n.js (renamed from web-ui/app/js/account_recovery/i18n.js)0
-rw-r--r--web-ui/test/jasmine.json9
-rw-r--r--web-ui/test/test-main.js2
-rw-r--r--web-ui/test/unit/account_recovery/page.spec.js (renamed from web-ui/test/spec/account_recovery/page.spec.js)4
-rw-r--r--web-ui/webpack.config.js2
-rw-r--r--web-ui/webpack.production.config.js2
15 files changed, 20 insertions, 28 deletions
diff --git a/web-ui/.jshintignore b/web-ui/.jshintignore
index df04d870..b28da15f 100644
--- a/web-ui/.jshintignore
+++ b/web-ui/.jshintignore
@@ -2,6 +2,5 @@ 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
+src/
+test/unit
diff --git a/web-ui/config/alias-webpack.js b/web-ui/config/alias-webpack.js
index 43b23836..d316bb2d 100644
--- a/web-ui/config/alias-webpack.js
+++ b/web-ui/config/alias-webpack.js
@@ -7,6 +7,7 @@ module.exports = {
'flight': path.join(__dirname, '../app/bower_components/flight'),
'found': path.join(__dirname, '../app/bower_components/foundation'),
'js': path.join(__dirname, '../app/js'),
+ 'src': path.join(__dirname, '../src'),
'scss': path.join(__dirname, '../app/scss'),
'mail_list': path.join(__dirname, '../app/js/mail_list'),
'page': path.join(__dirname, '../app/js/page'),
diff --git a/web-ui/config/copy-webpack.js b/web-ui/config/copy-webpack.js
index a2567be6..8e9f9dd3 100644
--- a/web-ui/config/copy-webpack.js
+++ b/web-ui/config/copy-webpack.js
@@ -4,7 +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: 'src/account_recovery/', from: 'account_recovery.html' },
{ context: 'app/', from: 'css/*' },
{ context: 'app/', from: 'fonts/*' },
{ context: 'app/', from: 'locales/**/*' },
diff --git a/web-ui/karma.conf.js b/web-ui/karma.conf.js
index d10667e9..2895dc42 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|account_recovery)/**/*.js': ['coverage']
+ 'app/js/!(lib)/**/*.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 ff4201c0..dba34e97 100644
--- a/web-ui/package.json
+++ b/web-ui/package.json
@@ -65,7 +65,8 @@
},
"scripts": {
"test": "npm run jshint --silent && npm run build-statics --silent && npm run mocha-test && npm run karma-test",
- "mocha-test": "mocha-webpack --webpack-config webpack.test.config.js \"test/spec/account_recovery/**/*.spec.js\"",
+ "mocha-test": "mocha-webpack --webpack-config webpack.test.config.js \"test/unit/**/*.spec.js\"",
+ "mocha-watch": "mocha-webpack --watch --webpack-config webpack.test.config.js \"test/unit/**/*.spec.js\"",
"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",
diff --git a/web-ui/app/account_recovery.html b/web-ui/src/account_recovery/account_recovery.html
index bd451ebc..bd451ebc 100644
--- a/web-ui/app/account_recovery.html
+++ b/web-ui/src/account_recovery/account_recovery.html
diff --git a/web-ui/app/js/account_recovery.js b/web-ui/src/account_recovery/account_recovery.js
index cd01378d..f2421bfc 100644
--- a/web-ui/app/js/account_recovery.js
+++ b/web-ui/src/account_recovery/account_recovery.js
@@ -3,8 +3,8 @@ import { render } from 'react-dom'
import a11y from 'react-a11y'
import { I18nextProvider } from 'react-i18next'
-import Page from 'js/account_recovery/page'
-import i18n from 'js/account_recovery/i18n'
+import Page from './page'
+import i18n from '../i18n'
import 'font-awesome/scss/font-awesome.scss'
diff --git a/web-ui/app/js/account_recovery/page.js b/web-ui/src/account_recovery/page.js
index a94c2c45..a02d307c 100644
--- a/web-ui/app/js/account_recovery/page.js
+++ b/web-ui/src/account_recovery/page.js
@@ -1,7 +1,7 @@
import React from 'react'
import { translate } from 'react-i18next'
-import 'scss/account_recovery/page.scss'
+import './page.scss'
export const Page = ({ t }) => (
<div className='container'>
diff --git a/web-ui/app/scss/account_recovery/page.scss b/web-ui/src/account_recovery/page.scss
index 8bba1b5a..e7b1504e 100644
--- a/web-ui/app/scss/account_recovery/page.scss
+++ b/web-ui/src/account_recovery/page.scss
@@ -1,6 +1,6 @@
-@import "../vendor/reset";
-@import "../base/colors";
-@import "../base/fonts";
+@import "~scss/vendor/reset";
+@import "~scss/base/colors";
+@import "~scss/base/fonts";
html {
min-height: 100%;
@@ -103,7 +103,7 @@ button {
.container {
background: $white;
width: 84%;
- margin: 3% auto;
+ // margin: 3% auto;
padding: 6% 5%;
-webkit-display: flex;
@@ -132,7 +132,7 @@ img {
flex-direction: column;
.field-group, button, div {
- width: 70%;
+ flex-basis: 70%;
-webkit-align-self: center;
align-self: center;
}
diff --git a/web-ui/app/js/account_recovery/i18n.js b/web-ui/src/i18n.js
index 9c6ad550..9c6ad550 100644
--- a/web-ui/app/js/account_recovery/i18n.js
+++ b/web-ui/src/i18n.js
diff --git a/web-ui/test/jasmine.json b/web-ui/test/jasmine.json
deleted file mode 100644
index 969304b6..00000000
--- a/web-ui/test/jasmine.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "spec_dir": "test/spec/account_recovery/",
- "spec_files": [
- "**/*[sS]pec.js"
- ],
- "helpers": [
- "helpers/**/*.js"
- ]
-}
diff --git a/web-ui/test/test-main.js b/web-ui/test/test-main.js
index b7dc430f..4396993f 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 !(/account_recovery/.test(file)) && (/\.spec\.js$/.test(file));
+ return (/\.spec\.js$/.test(file));
});
beforeEach(function() {
diff --git a/web-ui/test/spec/account_recovery/page.spec.js b/web-ui/test/unit/account_recovery/page.spec.js
index 3e19f244..151f09e1 100644
--- a/web-ui/test/spec/account_recovery/page.spec.js
+++ b/web-ui/test/unit/account_recovery/page.spec.js
@@ -1,7 +1,7 @@
-import {shallow} from 'enzyme'
+import { shallow } from 'enzyme'
import expect from 'expect'
import React from 'react'
-import { Page } from '../../../app/js/account_recovery/page'
+import { Page } from 'src/account_recovery/page'
describe('Page', () => {
it('renders backup email page title', () => {
diff --git a/web-ui/webpack.config.js b/web-ui/webpack.config.js
index 5886154a..9171b8f5 100644
--- a/web-ui/webpack.config.js
+++ b/web-ui/webpack.config.js
@@ -7,7 +7,7 @@ var aliases = require('./config/alias-webpack');
module.exports = {
entry: {
app: './app/js/index.js',
- account_recovery: './app/js/account_recovery.js',
+ account_recovery: './src/account_recovery/account_recovery.js',
sandbox: './app/js/sandbox.js'
},
node: { fs: 'empty' },
diff --git a/web-ui/webpack.production.config.js b/web-ui/webpack.production.config.js
index cf8ab8ff..6948d78e 100644
--- a/web-ui/webpack.production.config.js
+++ b/web-ui/webpack.production.config.js
@@ -7,7 +7,7 @@ var aliases = require('./config/alias-webpack');
module.exports = {
entry: {
app: './app/js/index.js',
- account_recovery: './app/js/account_recovery.js',
+ account_recovery: './src/account_recovery/index.js',
sandbox: './app/js/sandbox.js'
},
node: { fs: 'empty' },