import React from 'react'
import { mount, shallow } from 'enzyme'
import { Button } from '../button'
import { TopBar } from './TopBar'
describe('TopBar', () => {
it('should not have the scrolled class if hasScrolled is false or null', () => {
const topBar = shallow()
expect(topBar.hasClass('kirk-topBar--scrolled')).toBe(false)
})
it('should not have the scrolled class if hasScrolled is true', () => {
const topBar = shallow()
expect(topBar.hasClass('kirk-topBar--scrolled')).toBe(true)
})
it('should have a clickable button ', () => {
const onClick = jest.fn()
const topBar = mount(} />)
expect(topBar.find('button')).toHaveLength(1)
const button = topBar.find('button')
button.simulate('click')
expect(onClick).toHaveBeenCalledTimes(1)
})
it('should have a left area with a button', () => {
const topBar = mount(} />)
const leftArea = topBar.find('.kirk-topBar-left')
expect(leftArea.contains()).toBe(true)
})
it('should have a right area with a span', () => {
const topBar = mount(Test} />)
const rightArea = topBar.find('.kirk-topBar-right')
expect(rightArea.contains(Test)).toBe(true)
})
it('should have a center area', () => {
const topBar = mount(Test} />)
expect(topBar.find('.kirk-topBar-center')).toHaveLength(1)
})
})