@@ -2,6 +2,12 @@ import React from 'react';
2
2
import ComponentsList from './ComponentsList' ;
3
3
import { ComponentsListRenderer } from './ComponentsListRenderer' ;
4
4
5
+ const context = {
6
+ config : {
7
+ pagePerSection : true ,
8
+ } ,
9
+ } ;
10
+
5
11
it ( 'should set the correct href for items' , ( ) => {
6
12
const components = [
7
13
{
@@ -16,7 +22,7 @@ it('should set the correct href for items', () => {
16
22
} ,
17
23
] ;
18
24
19
- const actual = shallow ( < ComponentsList items = { components } classes = { { } } /> ) ;
25
+ const actual = shallow ( < ComponentsList items = { components } classes = { { } } /> , { context } ) ;
20
26
expect ( actual ) . toMatchSnapshot ( ) ;
21
27
} ) ;
22
28
@@ -34,7 +40,7 @@ it('if a custom href is provided, should use it instead of generating internal l
34
40
} ,
35
41
] ;
36
42
37
- const actual = shallow ( < ComponentsList items = { components } classes = { { } } /> ) ;
43
+ const actual = shallow ( < ComponentsList items = { components } classes = { { } } /> , { context } ) ;
38
44
expect ( actual ) . toMatchSnapshot ( ) ;
39
45
} ) ;
40
46
@@ -51,15 +57,15 @@ it('should set a parameter on link when useHashId is activated', () => {
51
57
slug : 'input' ,
52
58
} ,
53
59
] ;
54
-
55
60
const actual = shallow (
56
61
< ComponentsList
57
62
items = { components }
58
63
classes = { { } }
59
64
useRouterLinks
60
65
hashPath = { [ 'Components' ] }
61
66
useHashId
62
- />
67
+ /> ,
68
+ { context }
63
69
) ;
64
70
expect ( actual ) . toMatchSnapshot ( ) ;
65
71
} ) ;
@@ -83,7 +89,8 @@ it('should set a sub route on link when useHashId is deactivated', () => {
83
89
useRouterLinks
84
90
hashPath = { [ 'Components' ] }
85
91
useHashId = { false }
86
- />
92
+ /> ,
93
+ { context }
87
94
) ;
88
95
expect ( actual ) . toMatchSnapshot ( ) ;
89
96
} ) ;
@@ -101,13 +108,13 @@ it('should render sections with nested components', () => {
101
108
href : '#input' ,
102
109
} ,
103
110
] ;
104
- const actual = shallow ( < ComponentsListRenderer items = { components } classes = { { } } /> ) ;
111
+ const actual = shallow ( < ComponentsListRenderer items = { components } classes = { { } } /> , { context } ) ;
105
112
106
113
expect ( actual ) . toMatchSnapshot ( ) ;
107
114
} ) ;
108
115
109
116
it ( 'should return null when the list is empty' , ( ) => {
110
- const actual = shallow ( < ComponentsListRenderer items = { [ ] } classes = { { } } /> ) ;
117
+ const actual = shallow ( < ComponentsListRenderer items = { [ ] } classes = { { } } /> , { context } ) ;
111
118
112
119
expect ( actual . getElement ( ) ) . toBe ( null ) ;
113
120
} ) ;
@@ -124,7 +131,7 @@ it('should ignore items without visibleName', () => {
124
131
href : '#input' ,
125
132
} ,
126
133
] ;
127
- const actual = shallow ( < ComponentsListRenderer items = { components } classes = { { } } /> ) ;
134
+ const actual = shallow ( < ComponentsListRenderer items = { components } classes = { { } } /> , { context } ) ;
128
135
129
136
expect ( actual ) . toMatchSnapshot ( ) ;
130
137
} ) ;
0 commit comments