Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ui-component-library / src / forms / __unused / ToggleOld / __tests__ / checkbox.test.tsx
Size: Mime:
import React from 'react'
import ReactDOM from 'react-dom'
import ReactTestUtils from 'react-dom/test-utils'
import { ToggleMolecule } from 'src/components/molecules/Toggle/ToggleMolecule'
import { toCommonState } from 'src/state/common'

describe('Test checkbox', () => {
  it('should be able to toggle the checkbox and change the state', () => {
    const state = toCommonState({})
    const { isVisible, handleToggleVisibility } = state
    const Checkbox = ReactTestUtils.renderIntoDocument(
      <ToggleMolecule
        name={'checkbox'}
        className={'toggle-view'}
        isRadio={false}
        isSelected={!isVisible}
        onClick={handleToggleVisibility}
      />
    )
    const checkboxNode = ReactDOM.findDOMNode(Checkbox)
    expect(state.isVisible).toBeFalsy()
    ReactTestUtils.Simulate.click(checkboxNode)
    expect(state.isVisible).toBeTruthy()
    ReactTestUtils.Simulate.click(checkboxNode)
    expect(state.isVisible).toBeFalsy()
  })
})