import React from 'react'
import { render } from '@testing-library/react'
import { SlideSection } from './index'
describe('SlideSection', () => {
it('Should render the elements from media prop', () => {
const { getByText } = render(
Media}>{() => Children
},
)
expect(getByText('Media')).toBeInTheDocument()
})
it('Should render the elements from reducedContent prop', () => {
const { getByText } = render(
Media} reducedContent={ReducedContent
}>
{() => Children
}
,
)
expect(getByText('ReducedContent')).toBeInTheDocument()
})
it('Should render its children', () => {
const { getByText } = render(
Media}>{() => Children
},
)
expect(getByText('Children')).toBeInTheDocument()
})
it('Should change the position when calling the children methods', () => {
const { container, getByText } = render(
Media}>
{(setDefaultPosition, setReducedPosition, setExpandedPosition) => (
)}
,
)
getByText('reduce').click()
expect(container.querySelector('.reduced')).toBeInTheDocument()
getByText('expand').click()
expect(container.querySelector('.expanded')).toBeInTheDocument()
getByText('default').click()
expect(container.querySelector('.default')).toBeInTheDocument()
})
})