diff --git a/circle.yml b/circle.yml
index 4d1f54286..160bc7bb9 100644
--- a/circle.yml
+++ b/circle.yml
@@ -5,11 +5,21 @@ machine:
- docker
- redis
+dependencies:
+ post:
+ # Lint the project here, before tests are ran.
+ - npm run lint
+
+database:
+ post:
+ # Initialize the settings in the database, this will create indicies for the
+ # database.
+ - ./bin/cli settings init
+ - sleep 2
+
test:
override:
- - npm run lint
- - ./bin/cli settings init
- - sleep 5
+ # Run the tests using the junit reporter.
- MOCHA_FILE=$CIRCLE_TEST_REPORTS/junit/test-results.xml NPM_PACKAGE_CONFIG_MOCHA_REPORTER=mocha-junit-reporter npm run test
deployment:
diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js
index 94912949d..5922266fa 100644
--- a/client/coral-embed-stream/src/Embed.js
+++ b/client/coral-embed-stream/src/Embed.js
@@ -9,10 +9,9 @@ const {logout, showSignInDialog} = authActions;
const {addNotification, clearNotification} = notificationActions;
const {fetchAssetSuccess} = assetActions;
-import pym from './PymConnection';
import {queryStream} from './graphql/queries';
import {postComment, postAction, deleteAction} from './graphql/mutations';
-import {Notification, notificationActions, authActions, assetActions} from 'coral-framework';
+import {Notification, notificationActions, authActions, assetActions, pym} from 'coral-framework';
import Stream from './Stream';
import InfoBox from 'coral-plugin-infobox/InfoBox';
@@ -95,7 +94,7 @@ class Embed extends Component {
const {loggedIn, isAdmin, user, showSignInDialog, signInOffset} = this.props.auth;
const expandForLogin = showSignInDialog ? {
- minHeight: document.body.scrollHeight + 150
+ minHeight: document.body.scrollHeight + 200
} : {};
return
diff --git a/client/coral-embed-stream/src/PymConnection.js b/client/coral-embed-stream/src/PymConnection.js
deleted file mode 100644
index cdbf95c2f..000000000
--- a/client/coral-embed-stream/src/PymConnection.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import Pym from '../../../node_modules/pym.js';
-
-export default new Pym.Child({polling: 100});
diff --git a/client/coral-embed-stream/src/graphql/queries/index.js b/client/coral-embed-stream/src/graphql/queries/index.js
index b57c3ecf3..ae01ea9f4 100644
--- a/client/coral-embed-stream/src/graphql/queries/index.js
+++ b/client/coral-embed-stream/src/graphql/queries/index.js
@@ -1,6 +1,6 @@
import {graphql} from 'react-apollo';
import STREAM_QUERY from './streamQuery.graphql';
-import pym from '../../PymConnection';
+import pym from 'coral-framework/PymConnection';
let url = pym.parentUrl.split('#')[0] || 'http://localhost:3000/';
diff --git a/client/coral-framework/PymConnection.js b/client/coral-framework/PymConnection.js
new file mode 100644
index 000000000..ca592b824
--- /dev/null
+++ b/client/coral-framework/PymConnection.js
@@ -0,0 +1,9 @@
+import Pym from '../../node_modules/pym.js';
+
+const pym = new Pym.Child({polling: 100});
+export default pym;
+
+export const link = (url) => (e) => {
+ e.preventDefault();
+ pym.sendMessage('navigate', url);
+};
diff --git a/client/coral-framework/index.js b/client/coral-framework/index.js
index 81a0dc1c2..3d3ec03e4 100644
--- a/client/coral-framework/index.js
+++ b/client/coral-framework/index.js
@@ -5,6 +5,7 @@ import I18n from './modules/i18n/i18n';
import * as notificationActions from './actions/notification';
import * as authActions from './actions/auth';
import * as assetActions from './actions/asset';
+import pym from './PymConnection';
export {
Notification,
@@ -13,5 +14,7 @@ export {
I18n,
notificationActions,
authActions,
- assetActions
+ configActions,
+ assetActions,
+ pym
};
diff --git a/client/coral-plugin-history/Comment.js b/client/coral-plugin-history/Comment.js
index 036753623..df61b9e7d 100644
--- a/client/coral-plugin-history/Comment.js
+++ b/client/coral-plugin-history/Comment.js
@@ -1,12 +1,11 @@
import React, {PropTypes} from 'react';
-
import styles from './Comment.css';
const Comment = props => {
return (
diff --git a/client/coral-plugin-history/CommentHistory.js b/client/coral-plugin-history/CommentHistory.js
index c18846066..add7c121a 100644
--- a/client/coral-plugin-history/CommentHistory.js
+++ b/client/coral-plugin-history/CommentHistory.js
@@ -11,6 +11,7 @@ const CommentHistory = props => {
return
;
})}
diff --git a/client/coral-settings/containers/SettingsContainer.js b/client/coral-settings/containers/SettingsContainer.js
index e7b930255..001190f1d 100644
--- a/client/coral-settings/containers/SettingsContainer.js
+++ b/client/coral-settings/containers/SettingsContainer.js
@@ -3,6 +3,7 @@ import {connect} from 'react-redux';
import {saveBio, fetchCommentsByUserId} from 'coral-framework/actions/user';
+import {link} from 'coral-framework/PymConnection';
import BioContainer from './BioContainer';
import NotLoggedIn from '../components/NotLoggedIn';
import {TabBar, Tab, TabContent} from '../../coral-ui';
@@ -62,6 +63,7 @@ class SettingsContainer extends Component {
user.myComments.length && user.myAssets.length
? items.assets[id])} />
: {lang.t('user-no-comment')}
}
diff --git a/test/client/coral-plugin-history/Comment.spec.js b/test/client/coral-plugin-history/Comment.spec.js
index 78ad104bf..6d69d54cd 100644
--- a/test/client/coral-plugin-history/Comment.spec.js
+++ b/test/client/coral-plugin-history/Comment.spec.js
@@ -9,20 +9,19 @@ describe('coral-plugin-history/Comment', () => {
const asset = {url: 'https://google.com'};
beforeEach(() => {
- render = shallow();
+ render = shallow({}}/>);
});
it('should render the provided comment body', () => {
- const wrapper = mount();
+ const wrapper = mount({}}/>);
expect(wrapper.find('.myCommentBody')).to.have.length(1);
expect(wrapper.find('.myCommentBody').text()).to.equal('this is a comment');
});
it('should render the asset url as a link', () => {
- const wrapper = mount();
+ const wrapper = mount({}}/>);
expect(wrapper.find('.myCommentAnchor')).to.have.length(1);
expect(wrapper.find('.myCommentAnchor').text()).to.equal('https://google.com');
- expect(wrapper.find('.myCommentAnchor').props().href).to.equal('https://google.com#123');
});
it('should render the comment with styles', () => {
diff --git a/test/client/coral-plugin-history/CommentHistory.spec.js b/test/client/coral-plugin-history/CommentHistory.spec.js
index 3b6f5ee47..9d81f79cd 100644
--- a/test/client/coral-plugin-history/CommentHistory.spec.js
+++ b/test/client/coral-plugin-history/CommentHistory.spec.js
@@ -9,11 +9,11 @@ describe('coral-plugin-history/CommentHistory', () => {
const assets = [{'settings': null, 'created_at':'2016-12-06T21:36:09.302Z', 'url':'localhost:3000/', 'scraped':null, 'status':'open', 'updated_at':'2016-12-08T02:11:15.943Z', '_id':'58472f499e775a38f23d5da0', 'type':'article', 'closedMessage':null, 'id':'7302e637-f884-47c0-9723-02cc10a18617', 'closedAt':null}, {'settings':null, 'created_at':'2016-12-07T02:25:31.983Z', 'url':'http://localhost:3000/', 'scraped':null, 'status':'open', 'updated_at':'2016-12-13T22:58:36.061Z', '_id':'5847731b9e775a38f23d5da1', 'type':'article', 'closedMessage':null, 'id':'96fddf96-7c83-4008-80ad-50091997d006', 'closedAt':null}, {'settings':null, 'created_at':'2016-12-12T19:04:05.770Z', 'url':'http://localhost:3000/embed/stream', 'scraped':null, 'updated_at':'2016-12-14T20:13:21.934Z', '_id':'584ef4a59e775a38f23d5e86', 'type':'article', 'closedMessage':null, 'id':'cef81015-1b53-4d70-b9af-6eca680f22fc', 'closedAt':null}];
beforeEach(() => {
- render = shallow();
+ render = shallow({}}/>);
});
it('should render Comments as children when given comments and assets', () => {
- const wrapper = mount();
+ const wrapper = mount({}}/>);
expect(wrapper.find('.commentHistory__list').children()).to.have.length(7);
});
@@ -21,4 +21,3 @@ describe('coral-plugin-history/CommentHistory', () => {
expect(render.props().style).to.be.defined;
});
});
-
diff --git a/views/article.ejs b/views/article.ejs
index 302d76572..c63acc62b 100644
--- a/views/article.ejs
+++ b/views/article.ejs
@@ -46,6 +46,9 @@
}
}, 100);
});
+ pymParent.onMessage('navigate', function (url) {
+ window.open(url, '_blank').focus();
+ })
// wait till images and other iframes are loaded before scrolling the page.
// or do we want to be more aggressive and scroll when we hit DOM ready?
diff --git a/views/embed-stream.ejs b/views/embed-stream.ejs
index a05b699f1..c69773bcb 100644
--- a/views/embed-stream.ejs
+++ b/views/embed-stream.ejs
@@ -31,7 +31,11 @@
pymParent.sendMessage('DOMContentLoaded', window.location.hash);
}
}, 100);
- });
+ }
+ pymParent.onMessage('navigate', function (url) {
+ window.open(url, '_blank').focus();
+ })
+ );
// wait till images and other iframes are loaded before scrolling the page.
// or do we want to be more aggressive and scroll when we hit DOM ready?