From 6abb5f1449b582f50796c71bbf20d8e4aac2f4de Mon Sep 17 00:00:00 2001 From: Simon Fondrie-Teitler Date: Thu, 18 May 2017 23:20:16 -0400 Subject: [refactor] refactor and add tests for Center and Confirmation As a couple of initial, example tests, Center and Confirmation were refactored and tests were set up and added with mocha, enzyme and chai. Spinner was also refactored. --- ui/test/components/center.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 ui/test/components/center.js (limited to 'ui/test/components/center.js') diff --git a/ui/test/components/center.js b/ui/test/components/center.js new file mode 100644 index 00000000..e9242e7d --- /dev/null +++ b/ui/test/components/center.js @@ -0,0 +1,43 @@ +import React from 'react'; +import {shallow} from 'enzyme'; +import chaiEnzyme from 'chai-enzyme' +import chai, { expect } from 'chai' +import Center from '../../app/components/center'; + + +describe('Center Component', () => { + + chai.use(chaiEnzyme()) + + it('has reasonable defaults', () => { + const center = shallow( +
+ test +
+ ) + + expect(center.hasClass("center-both")) + + expect(center.find(".center-item")).to.not.have.style('width') + }) + + it('has a width parameter on the inner div', () => { + const center = shallow( +
+ test +
+ ) + + expect(center.find(".center-item")).to.have.style('width').equal('10px') + }) + + it('sets direction parameter in the class name', () => { + const center = shallow( +
+ test +
+ ) + + expect(center).to.have.className("center-vertically") + }) +}) -- cgit v1.2.3