outline-root.test.js 800 B

12345678910111213141516171819202122232425262728293031
  1. import { expect } from 'chai'
  2. import React from 'react'
  3. import { screen, render } from '@testing-library/react'
  4. import OutlineRoot from '../../../../../frontend/js/features/outline/components/outline-root'
  5. describe('<OutlineRoot />', function() {
  6. const jumpToLine = () => {}
  7. it('renders outline', function() {
  8. const outline = [
  9. {
  10. title: 'Section',
  11. line: 1,
  12. level: 10
  13. }
  14. ]
  15. render(<OutlineRoot outline={outline} jumpToLine={jumpToLine} />)
  16. screen.getByRole('tree')
  17. expect(screen.queryByRole('link')).to.be.null
  18. })
  19. it('renders placeholder', function() {
  20. const outline = []
  21. render(<OutlineRoot outline={outline} jumpToLine={jumpToLine} />)
  22. expect(screen.queryByRole('tree')).to.be.null
  23. screen.getByRole('link')
  24. })
  25. })