2020-09-18 06:05:05 -04:00
|
|
|
import { expect } from 'chai'
|
|
|
|
import { screen, render } from '@testing-library/react'
|
|
|
|
|
|
|
|
import OutlineRoot from '../../../../../frontend/js/features/outline/components/outline-root'
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
describe('<OutlineRoot />', function () {
|
2020-09-18 06:05:05 -04:00
|
|
|
const jumpToLine = () => {}
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
it('renders outline', function () {
|
2020-09-18 06:05:05 -04:00
|
|
|
const outline = [
|
|
|
|
{
|
|
|
|
title: 'Section',
|
|
|
|
line: 1,
|
2021-04-27 03:52:58 -04:00
|
|
|
level: 10,
|
|
|
|
},
|
2020-09-18 06:05:05 -04:00
|
|
|
]
|
|
|
|
render(<OutlineRoot outline={outline} jumpToLine={jumpToLine} />)
|
|
|
|
|
|
|
|
screen.getByRole('tree')
|
|
|
|
expect(screen.queryByRole('link')).to.be.null
|
|
|
|
})
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
it('renders placeholder', function () {
|
2020-09-18 06:05:05 -04:00
|
|
|
const outline = []
|
|
|
|
render(<OutlineRoot outline={outline} jumpToLine={jumpToLine} />)
|
|
|
|
|
|
|
|
expect(screen.queryByRole('tree')).to.be.null
|
|
|
|
screen.getByRole('link')
|
|
|
|
})
|
|
|
|
})
|