Skip to content

Commit

Permalink
Update and fix eslint and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zalmoxisus committed Jan 8, 2016
1 parent a54f85d commit 1b71f4a
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 22 deletions.
4 changes: 3 additions & 1 deletion gulp/tasks/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ gulp.task('compress:electron:osx', () => {
console.warn('paths', paths);
const builder = electronBuilder.init();
builder.build({
appPath: path.resolve(`./build/executables/${config.productName}-darwin-x64/${config.productName}.app`),
appPath: path.resolve(
`./build/executables/${config.productName}-darwin-x64/${config.productName}.app`
),
platform: 'osx',
out: path.resolve('./build'),
config: './src/electron/resources/config.json'
Expand Down
6 changes: 4 additions & 2 deletions gulp/tasks/copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ const copy = (dest, manifest) => () => {
};

gulp.task('copy:dev', copy('./dev', 'browser/extension/manifest.dev.json'));
gulp.task('copy:build:extension', copy('./build/extension', 'browser/extension/manifest.prod.json'));
gulp.task('copy:build:extension',
copy('./build/extension', 'browser/extension/manifest.prod.json'));
gulp.task('copy:build:app', copy('./build/app', 'chromeApp/manifest.json'));
gulp.task('copy:build:web', copy('./build/web'));

gulp.task('copy:build:electron', () => {
gulp.src(['./src/electron/**', '!./src/electron/resources', '!./src/electron/resources/**']).pipe(gulp.dest('./build/electron'));
gulp.src(['./src/electron/**', '!./src/electron/resources', '!./src/electron/resources/**'])
.pipe(gulp.dest('./build/electron'));
copy('./build/electron')();
});

Expand Down
1 change: 0 additions & 1 deletion gulp/tasks/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import jade from 'gulp-jade';
const paths = ['./src/browser/views/*.jade', './src/views/*.jade'];

const compile = (dest, path, env = 'prod') => () => {
const paths = ['./src/browser/views/*.jade', './src/views/*.jade'];
gulp.src(path)
.pipe(jade({
locals: { env }
Expand Down
6 changes: 4 additions & 2 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ requireDir('./gulp/tasks');

gulp.task('default', ['replace-webpack-code', 'webpack-dev-server', 'views:dev', 'copy:dev']);
gulp.task('build:web', ['webpack:build:web', 'views:build:web', 'copy:build:web']);
gulp.task('build:electron', ['webpack:build:electron', 'views:build:electron', 'copy:build:electron']);
gulp.task('build:extension', ['webpack:build:extension', 'views:build:extension', 'copy:build:extension']);
gulp.task('build:electron',
['webpack:build:electron', 'views:build:electron', 'copy:build:electron']);
gulp.task('build:extension',
['webpack:build:extension', 'views:build:extension', 'copy:build:extension']);
gulp.task('build:app', ['webpack:build:app', 'views:build:app', 'copy:build:app']);
gulp.task('build:firefox', ['copy:build:firefox']);
gulp.task('test-app', ['app:test']);
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
"electron-prebuilt": "^0.36.2",
"enzyme": "^1.2.0",
"eslint": "^1.10.3",
"eslint-config-airbnb": "^2.1.1",
"eslint-plugin-react": "^3.11.3",
"expect": "^1.13.3",
"eslint-config-airbnb": "^3.1.0",
"eslint-plugin-react": "^3.14.0",
"expect": "^1.13.4",
"gulp": "^3.9.0",
"gulp-jade": "1.1.0",
"gulp-mocha": "^2.2.0",
Expand All @@ -80,7 +80,7 @@
"gulp-zip": "^3.0.2",
"mocha": "^2.3.4",
"raw-loader": "^0.5.1",
"react-addons-test-utils": "^0.14.3",
"react-addons-test-utils": "^0.14.6",
"react-transform-catch-errors": "^1.0.0",
"react-transform-hmr": "^1.0.1",
"redbox-react": "^1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Counter = ({ increment, incrementIfOdd, incrementAsync, decrement, state }
<div className="rule"></div>
<button className="btn" onClick={incrementIfOdd}>Increment if odd</button>
<br />
<button className="btn" onClick={() => incrementAsync()}>Increment async</button>
<button className="btn" onClick={incrementAsync}>Increment async</button>
</div>
);

Expand Down
9 changes: 7 additions & 2 deletions src/app/reducers/counter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { INCREMENT_COUNTER, DECREMENT_COUNTER, NOTIFY_SEND, NOTIFY_RECEIVE } from '../constants/ActionTypes';
import {
INCREMENT_COUNTER, DECREMENT_COUNTER, NOTIFY_SEND, NOTIFY_RECEIVE
} from '../constants/ActionTypes';

export default function counter(state = { count: 0 }, action) {
if (typeof window === 'object' && window.bgBadge && (action.type === NOTIFY_SEND || action.type === NOTIFY_RECEIVE)) {
if (
typeof window === 'object' && window.bgBadge &&
(action.type === NOTIFY_SEND || action.type === NOTIFY_RECEIVE)
) {
window.bgBadge(state.count); return state;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/store/configureStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import notifyEvents from '../events/notifyEvents';

export default function configureStore(callback, isBg) {
let getState;
if (isBg === undefined) getState = require('./getStoredState'); // If you do not want to persist states, use './getDefaultState'
if (isBg === undefined) getState = require('./getStoredState'); /* If you don't want to persist states, use './getDefaultState' */// eslint-disable-line max-len
else getState = (isBg ? require('./getStateToBg') : require('./getStateFromBg'));

getState(initialState => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/store/getStateToBg.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { onConnect } from 'crossmessaging';
import getState from './getStoredState'; // If you do not want to persist states, use './getDefaultState'
import getState from './getStoredState'; /* If you don't want to persist states, use './getDefaultState' */// eslint-disable-line max-len
import { receiveNotification } from '../actions/extension';

export default function (configure, callback) {
Expand Down
6 changes: 4 additions & 2 deletions src/browser/extension/background/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
if (changeInfo.status !== 'loading' || !tab.url.match(arrowURLs.join('|'))) return;

chrome.tabs.executeScript(tabId, {
code: 'var injected = window.browserReduxInjected; window.browserReduxInjected = true; injected;',
code: 'var injected = window.browserReduxInjected; window.browserReduxInjected = true; injected;', // eslint-disable-line max-len
runAt: 'document_start'
}, (result) => {
if (chrome.runtime.lastError || result[0]) return;
Expand All @@ -20,7 +20,9 @@ chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
httpRequest.send();
httpRequest.onreadystatechange = function () {
if (httpRequest.readyState === XMLHttpRequest.DONE && httpRequest.status === 200) {
chrome.tabs.executeScript(tabId, { code: httpRequest.responseText, runAt: 'document_start' });
chrome.tabs.executeScript(tabId,
{ code: httpRequest.responseText, runAt: 'document_start' }
);
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/chromeApp/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
chrome.app.runtime.onLaunched.addListener(function () {
chrome.app.window.create('index.html', {
'state': 'normal'
state: 'normal'
// More parameters: https://developer.chrome.com/apps/app_window#CreateWindowOptions
});
});
3 changes: 2 additions & 1 deletion test/app/containers/App.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ describeWithDOM('containers', () => {
{ title: 'should display updated count after increment button click', result: '1' },
{ title: 'should display updated count after decrement button click', result: '-1' },
{ title: 'shouldnt change if even and if odd button clicked', result: '0' },
{ idx: 2, title: 'should change if odd and if odd button clicked', value: { counter: { count: 1 } }, result: '2' }
{ idx: 2, title: 'should change if odd and if odd button clicked',
value: { counter: { count: 1 } }, result: '2' }
]
.forEach((rule, idx) => {
it(rule.title, () => {
Expand Down
3 changes: 2 additions & 1 deletion test/chrome/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ describe('Chrome extension', function () {
doBefore.call(this, done, () => {
return this.driver.get('chrome://extensions-frame').then(() => {
this.driver.findElements(webdriver.By.xpath(
'//div[contains(@class,"extension-list-item-wrapper") and .//h2[contains(text(), "' + extensionName + '")]]'
'//div[contains(@class,"extension-list-item-wrapper") and ' +
'.//h2[contains(text(), "' + extensionName + '")]]'
)).then(elems =>
elems[0].getAttribute('id')
).then(id => {
Expand Down
2 changes: 1 addition & 1 deletion test/shared/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function doBefore(done, action, load, port = 9515, browser = 'chrome') {
.forBrowser(browser)
.build();
action().then(() => {
setTimeout(done, 1000);
setTimeout(done, 3000);
});
}

Expand Down
3 changes: 2 additions & 1 deletion test/shared/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export function hasClickedButton(className, idx, newValue, timeout) {
it('should click button with idx=' + idx, function (done) {
this.driver.findElement(
webdriver.By.xpath(
'//div[' + (className ? '@class="' + className + '" and ' : '') + './/span[text()="Clicked: "] and .//span[text()=" times"]]//button[' + idx + ']'
'//div[' + (className ? '@class="' + className + '" and ' : '') +
'.//span[text()="Clicked: "] and .//span[text()=" times"]]//button[' + idx + ']'
))
.click().then(() => done());
});
Expand Down

0 comments on commit 1b71f4a

Please sign in to comment.