import React from 'react'
import { mount } from '../../test/utils'

import { TextStyle } from '../TextStyle'

describe('<TextStyle />', () => {
  it('mounts', () => {
    const textStyle = mount(<TextStyle />)
    expect(textStyle).not.toBeNull()
  })

  it('renders its children', () => {
    const mockChildren = 'mock_children'
    const app = mount(<TextStyle>{mockChildren}</TextStyle>)
    expect(app).toContainReactText(mockChildren)
  })

  it('renders a span by default', () => {
    const textStyle = mount(<TextStyle>Lorem ipsum</TextStyle>)
    expect(textStyle).toContainReactComponent('span')
  })

  it('renders a span when the variant positive is provided', () => {
    const textStyle = mount(
      <TextStyle variation="positive">Lorem ipsum</TextStyle>
    )
    expect(textStyle).toContainReactComponent('span')
  })

  it('renders a span when the variant negative is provided', () => {
    const textStyle = mount(
      <TextStyle variation="negative">Lorem ipsum</TextStyle>
    )
    expect(textStyle).toContainReactComponent('span')
  })

  it('renders a span when the variant strong is provided', () => {
    const textStyle = mount(
      <TextStyle variation="strong">Lorem ipsum</TextStyle>
    )
    expect(textStyle).toContainReactComponent('span')
  })

  it('renders a span when the variant subdued is provided', () => {
    const textStyle = mount(
      <TextStyle variation="subdued">Lorem ipsum</TextStyle>
    )
    expect(textStyle).toContainReactComponent('span')
  })
})
