import React from 'react'
import renderer from 'react-test-renderer'
import { NavigationSticky } from '..'
import { mount } from 'enzyme'

describe('packages/ui/NavigationSticky', () => {
  it('renders a basic NavigationSticky', () => {
    const tree = renderer
      .create(
        <NavigationSticky name="foo">
          {({ name }) => <p>Test the {name}</p>}
        </NavigationSticky>
      )
      .toJSON()
    expect(tree).toMatchSnapshot()
  })

  it('renders a top sticky nav with height', () => {
    const wrapper = mount(
      <NavigationSticky name="foo" height={60}>
        {({ name }) => <p>Test the {name}</p>}
      </NavigationSticky>
    )
    expect(wrapper).toMatchSnapshot()
  })

  it('renders a bottom sticky nav with height', () => {
    const wrapper = mount(
      <NavigationSticky name="foo" height={60} isBottomVerticalPosition>
        {({ name }) => <p>Test the {name}</p>}
      </NavigationSticky>
    )
    expect(wrapper).toMatchSnapshot()
  })
})
