summaryrefslogtreecommitdiff
path: root/ui/test/components/center.js
blob: 7853481852acd95dd5edfadf0f830610a01a52fb (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
44
45
46
47
48
49
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>
        <span>
          test
        </span>
      </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">
        <span>
          test
        </span>
      </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">
        <span>
          test
        </span>
      </Center>
    )

    expect(center).to.have.className("center-vertically")
  })
})