@@ -2,6 +2,12 @@ import React from 'react';
22import ComponentsList from './ComponentsList' ;
33import { ComponentsListRenderer } from './ComponentsListRenderer' ;
44
5+ const context = {
6+ config : {
7+ pagePerSection : true ,
8+ } ,
9+ } ;
10+
511it ( 'should set the correct href for items' , ( ) => {
612 const components = [
713 {
@@ -16,7 +22,7 @@ it('should set the correct href for items', () => {
1622 } ,
1723 ] ;
1824
19- const actual = shallow ( < ComponentsList items = { components } classes = { { } } /> ) ;
25+ const actual = shallow ( < ComponentsList items = { components } classes = { { } } /> , { context } ) ;
2026 expect ( actual ) . toMatchSnapshot ( ) ;
2127} ) ;
2228
@@ -34,7 +40,7 @@ it('if a custom href is provided, should use it instead of generating internal l
3440 } ,
3541 ] ;
3642
37- const actual = shallow ( < ComponentsList items = { components } classes = { { } } /> ) ;
43+ const actual = shallow ( < ComponentsList items = { components } classes = { { } } /> , { context } ) ;
3844 expect ( actual ) . toMatchSnapshot ( ) ;
3945} ) ;
4046
@@ -51,15 +57,15 @@ it('should set a parameter on link when useHashId is activated', () => {
5157 slug : 'input' ,
5258 } ,
5359 ] ;
54-
5560 const actual = shallow (
5661 < ComponentsList
5762 items = { components }
5863 classes = { { } }
5964 useRouterLinks
6065 hashPath = { [ 'Components' ] }
6166 useHashId
62- />
67+ /> ,
68+ { context }
6369 ) ;
6470 expect ( actual ) . toMatchSnapshot ( ) ;
6571} ) ;
@@ -83,7 +89,8 @@ it('should set a sub route on link when useHashId is deactivated', () => {
8389 useRouterLinks
8490 hashPath = { [ 'Components' ] }
8591 useHashId = { false }
86- />
92+ /> ,
93+ { context }
8794 ) ;
8895 expect ( actual ) . toMatchSnapshot ( ) ;
8996} ) ;
@@ -101,13 +108,13 @@ it('should render sections with nested components', () => {
101108 href : '#input' ,
102109 } ,
103110 ] ;
104- const actual = shallow ( < ComponentsListRenderer items = { components } classes = { { } } /> ) ;
111+ const actual = shallow ( < ComponentsListRenderer items = { components } classes = { { } } /> , { context } ) ;
105112
106113 expect ( actual ) . toMatchSnapshot ( ) ;
107114} ) ;
108115
109116it ( 'should return null when the list is empty' , ( ) => {
110- const actual = shallow ( < ComponentsListRenderer items = { [ ] } classes = { { } } /> ) ;
117+ const actual = shallow ( < ComponentsListRenderer items = { [ ] } classes = { { } } /> , { context } ) ;
111118
112119 expect ( actual . getElement ( ) ) . toBe ( null ) ;
113120} ) ;
@@ -124,7 +131,7 @@ it('should ignore items without visibleName', () => {
124131 href : '#input' ,
125132 } ,
126133 ] ;
127- const actual = shallow ( < ComponentsListRenderer items = { components } classes = { { } } /> ) ;
134+ const actual = shallow ( < ComponentsListRenderer items = { components } classes = { { } } /> , { context } ) ;
128135
129136 expect ( actual ) . toMatchSnapshot ( ) ;
130137} ) ;
0 commit comments