summaryrefslogtreecommitdiff
path: root/ui/test/components/center.js
blob: e9242e7d8933a7fd0daf1df28654dd9965259c8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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")
  })
})