
import ReactDOM from 'react-dom'

import Heading from '@instructure/ui-elements/lib/components/Heading'

import PositionBox from '../PositionBox'

describe('Position Box', () => {
  const testbed = createTestbed(PositionBox, {
    position: '2',
    headingText: 'item number two'
  })

  shouldRenderComponent(testbed, {}, PositionBox)

  describe('rendering', () => {
    it('renders position when it is a string', () => {
      const stringPositon = '77'
      testbed.render({position: stringPositon})
      expect(testbed.getText()).to.include(stringPositon)
    })

    it('renders position when it is a number', () => {
      testbed.render({position: 33})
      expect(testbed.getText()).to.include('33')
    })

    it('renders the headingText in a Header component', () => {
      testbed.render()
      const heading = testbed.findChildByType(Heading)
      const headingText = ReactDOM.findDOMNode(heading).innerText
      expect(headingText).to.include('item number two')
    })
  })

  describe('a11y tests', () => {
    it('should meet a11y standards', (done) => {
      testbed.render()
      testbed.checkA11yStandards(done, {})
    })
  })
})
