Skip to content

Commit

Permalink
test(ZNTA-2116)
Browse files Browse the repository at this point in the history
  • Loading branch information
Earl Floden committed Jul 21, 2017
1 parent 3d35d54 commit e603e2e
Showing 1 changed file with 18 additions and 0 deletions.
Expand Up @@ -2,7 +2,9 @@
jest.disableAutomock()

import React from 'react'
import ReactDOM from 'react-dom'
import ReactDOMServer from 'react-dom/server'
import TestUtils from 'react-dom/test-utils'
import TriCheckbox from '.'

describe('TriCheckbox', () => {
Expand Down Expand Up @@ -55,4 +57,20 @@ describe('TriCheckbox', () => {
)
expect(actual).toEqual(expected)
})
it('can handle click from checked && !indeterminate state', () => {
const clickFun = function (e) {}
const slothCheckbox = TestUtils.renderIntoDocument(
<TriCheckbox
checked
indeterminate={false}
onChange={clickFun} />
)
try {
TestUtils.Simulate.click(ReactDOM.findDOMNode(slothCheckbox))
} catch (e) {
// swallow on purpose, valid for code to not bind onClick
}
expect(slothCheckbox.props.checked).toEqual(true)
expect(slothCheckbox.props.indeterminate).toEqual(false)
})
})

0 comments on commit e603e2e

Please sign in to comment.