From 624eaeee11ae39a48933a75fa1fcacd31c9ba84c Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Wed, 14 Dec 2016 12:01:32 -0700 Subject: [PATCH] move tests to tests directory --- client/coral-plugin-history/Comment.css | 3 +- client/coral-plugin-history/Comment.js | 6 ++-- package.json | 2 ++ .../coral-plugin-history/Comment.spec.js | 31 +++++++++++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 tests/client/coral-plugin-history/Comment.spec.js diff --git a/client/coral-plugin-history/Comment.css b/client/coral-plugin-history/Comment.css index 121839a1d..ba2a59f4b 100644 --- a/client/coral-plugin-history/Comment.css +++ b/client/coral-plugin-history/Comment.css @@ -1,5 +1,6 @@ .assetURL { - + font-size: 16px; + color: black; } .commentBody { diff --git a/client/coral-plugin-history/Comment.js b/client/coral-plugin-history/Comment.js index c7a1f5336..c54a0feef 100644 --- a/client/coral-plugin-history/Comment.js +++ b/client/coral-plugin-history/Comment.js @@ -5,8 +5,10 @@ import styles from './Comment.css'; const Comment = props => { return (
-

{props.asset.url}

-

{props.comment.body}

+

+ {props.asset.url} +

+

{props.comment.body}

); }; diff --git a/package.json b/package.json index 53af9910b..ee087a8d8 100644 --- a/package.json +++ b/package.json @@ -93,6 +93,7 @@ "copy-webpack-plugin": "^4.0.0", "css-loader": "^0.25.0", "dialog-polyfill": "^0.4.4", + "enzyme": "^2.6.0", "eslint": "^3.12.1", "eslint-config-postcss": "^2.0.2", "eslint-config-standard": "^6.2.1", @@ -122,6 +123,7 @@ "precss": "^1.4.0", "pym.js": "^1.1.1", "react": "15.3.2", + "react-addons-test-utils": "^15.3.1", "react-dom": "15.3.2", "react-linkify": "^0.1.3", "react-mdl": "^1.7.2", diff --git a/tests/client/coral-plugin-history/Comment.spec.js b/tests/client/coral-plugin-history/Comment.spec.js new file mode 100644 index 000000000..3f871cf0a --- /dev/null +++ b/tests/client/coral-plugin-history/Comment.spec.js @@ -0,0 +1,31 @@ +import React from 'react'; +import {shallow, mount} from 'enzyme'; +import {expect} from 'chai'; +import Comment from '../Comment'; + +describe('coral-plugin-history/Comment', () => { + let render; + beforeEach(() => { + + const comment = {body: 'this is a comment'}; + const asset = {url: 'https://google.com'}; + + render = shallow(); + }); + + it('should render the provided comment body', () => { + 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(); + expect(wrapper.find('.myCommentAnchor')).to.have.length(1); + expect(wrapper.find('.myCommentAnchor').text()).to.equal('https://google.com'); + }); + + it('should render the comment with styles', () => { + expect(render.props().style).to.be.defined; + }); +});