All files / icon/__tests__ Icon-test.js

100% Statements 17/17
100% Branches 0/0
83.33% Functions 5/6
100% Lines 16/16
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    1x 1x 1x 1x   1x 1x 1x 1x     1x 1x 1x         1x     1x 1x 1x         1x      
/* global describe, it */
 
import assert from 'assert'
import React from 'react'
import Icon from '../'
import {shallow} from 'enzyme'
 
describe('Icon', () => {
  it('should render Icon.AlarmOff', () => {
    const wrapper = shallow(<Icon.AlarmOff />)
    assert(wrapper.find('svg'))
  })
 
  it('should render icon button', () => {
    const onClick = () => {}
    const wrapper = shallow(
      <Icon.Button onClick={onClick}>
        <Icon.Person />
      </Icon.Button>
    )
    assert(wrapper.find('.IconButton'))
  })
 
  it('should bubble up button onclick event', (done) => {
    const onClick = () => done()
    const wrapper = shallow(
      <Icon.Button onClick={onClick}>
        <Icon.Person />
      </Icon.Button>
    )
    wrapper.find('.IconButton').simulate('click')
  })
})