summaryrefslogtreecommitdiff
path: root/ui/test/components/center.js
diff options
context:
space:
mode:
authorSimon Fondrie-Teitler <simonft@riseup.net>2017-05-18 23:20:16 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2017-05-22 13:46:44 +0200
commit6abb5f1449b582f50796c71bbf20d8e4aac2f4de (patch)
treeaa3fd693c58f228ee24eb973e99e9cbd08b9bf41 /ui/test/components/center.js
parenta8f8256c4f9671e4c971498835c443ccff8e9f5f (diff)
[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.
Diffstat (limited to 'ui/test/components/center.js')
-rw-r--r--ui/test/components/center.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/ui/test/components/center.js b/ui/test/components/center.js
new file mode 100644
index 0000000..e9242e7
--- /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(
+ <Center>
+ test
+ </Center>
+ )
+
+ 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(
+ <Center width="10">
+ test
+ </Center>
+ )
+
+ expect(center.find(".center-item")).to.have.style('width').equal('10px')
+ })
+
+ it('sets direction parameter in the class name', () => {
+ const center = shallow(
+ <Center direction="vertically">
+ test
+ </Center>
+ )
+
+ expect(center).to.have.className("center-vertically")
+ })
+})