aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/modal/modal-content/tests/modal-content.component.test.js
blob: 17af09f45f077cb08b7b7da12e60684e64f2dd4c (plain) (blame)
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
import React from 'react'
import assert from 'assert'
import { shallow } from 'enzyme'
import ModalContent from '../modal-content.component'

describe('ModalContent Component', () => {
  it('should render a title', () => {
    const wrapper = shallow(
      <ModalContent
        title="Modal Title"
      />
    )

    assert.equal(wrapper.find('.modal-content__title').length, 1)
    assert.equal(wrapper.find('.modal-content__title').text(), 'Modal Title')
    assert.equal(wrapper.find('.modal-content__description').length, 0)
  })

  it('should render a description', () => {
    const wrapper = shallow(
      <ModalContent
        description="Modal Description"
      />
    )

    assert.equal(wrapper.find('.modal-content__title').length, 0)
    assert.equal(wrapper.find('.modal-content__description').length, 1)
    assert.equal(wrapper.find('.modal-content__description').text(), 'Modal Description')
  })

  it('should render both a title and a description', () => {
    const wrapper = shallow(
      <ModalContent
        title="Modal Title"
        description="Modal Description"
      />
    )

    assert.equal(wrapper.find('.modal-content__title').length, 1)
    assert.equal(wrapper.find('.modal-content__title').text(), 'Modal Title')
    assert.equal(wrapper.find('.modal-content__description').length, 1)
    assert.equal(wrapper.find('.modal-content__description').text(), 'Modal Description')
  })
})