File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+ exports [` TOC component renders correctly 1` ] = `
4+ <details
5+ className = " toc"
6+ >
7+ <summary >
8+ <h6 >
9+ TABLE OF CONTENTS
10+ </h6 >
11+ </summary >
12+ <div
13+ dangerouslySetInnerHTML = {
14+ Object {
15+ " __html" : " mock-toc" ,
16+ }
17+ }
18+ />
19+ </details >
20+ ` ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import renderer from 'react-test-renderer' ;
3+ import TOC from '../../src/components/toc' ;
4+
5+ describe ( 'TOC component' , ( ) => {
6+ it ( 'renders correctly' , ( ) => {
7+ const heading = 'TABLE OF CONTENTS' ;
8+ const tableOfContents = 'mock-toc' ;
9+ const tree = renderer
10+ . create ( < TOC heading = { heading } tableOfContents = { tableOfContents } /> )
11+ . toJSON ( ) ;
12+ expect ( tree ) . toMatchSnapshot ( ) ;
13+ } ) ;
14+ it ( 'does not render without a table of contents' , ( ) => {
15+ const heading = 'TABLE OF CONTENTS' ;
16+ const tableOfContents = null ;
17+ const tree = renderer . create (
18+ < TOC heading = { heading } tableOfContents = { tableOfContents } />
19+ ) ;
20+ expect ( tree . getInstance ( ) ) . toBeNull ( ) ;
21+ } ) ;
22+ } ) ;
You can’t perform that action at this time.
0 commit comments