@@ -141,6 +141,20 @@ describe('IndexFilters', () => {
141
141
} ) ;
142
142
} ) ;
143
143
144
+ it ( 'passes the disclosureZIndexOverride to the Tabs when provided' , ( ) => {
145
+ const disclosureZIndexOverride = 517 ;
146
+ const wrapper = mountWithApp (
147
+ < IndexFilters
148
+ { ...defaultProps }
149
+ disclosureZIndexOverride = { disclosureZIndexOverride }
150
+ /> ,
151
+ ) ;
152
+
153
+ expect ( wrapper ) . toContainReactComponent ( Tabs , {
154
+ disclosureZIndexOverride,
155
+ } ) ;
156
+ } ) ;
157
+
144
158
it ( 'renders the SearchFilterButton tooltipContent with keyboard shortcut by default' , ( ) => {
145
159
const wrapper = mountWithApp ( < IndexFilters { ...defaultProps } /> ) ;
146
160
@@ -149,6 +163,20 @@ describe('IndexFilters', () => {
149
163
} ) ;
150
164
} ) ;
151
165
166
+ it ( 'passes the disclosureZIndexOverride to the SearchFilterButton when provided' , ( ) => {
167
+ const disclosureZIndexOverride = 517 ;
168
+ const wrapper = mountWithApp (
169
+ < IndexFilters
170
+ { ...defaultProps }
171
+ disclosureZIndexOverride = { disclosureZIndexOverride }
172
+ /> ,
173
+ ) ;
174
+
175
+ expect ( wrapper ) . toContainReactComponent ( SearchFilterButton , {
176
+ disclosureZIndexOverride,
177
+ } ) ;
178
+ } ) ;
179
+
152
180
it ( 'onQueryChange gets called correctly' , ( ) => {
153
181
const wrapper = mountWithApp (
154
182
< IndexFilters { ...defaultProps } mode = { IndexFiltersMode . Filtering } /> ,
@@ -161,13 +189,42 @@ describe('IndexFilters', () => {
161
189
expect ( defaultProps . onQueryChange ) . toHaveBeenCalledWith ( 'bar' ) ;
162
190
} ) ;
163
191
164
- it ( 'onSort gets called correctly' , ( ) => {
165
- const wrapper = mountWithApp ( < IndexFilters { ...defaultProps } /> ) ;
166
- wrapper . act ( ( ) => {
167
- wrapper . find ( SortButton ) ! . trigger ( 'onChange' , [ 'customer-name asc' ] ) ;
192
+ describe ( 'sortOptions' , ( ) => {
193
+ it ( 'does not render the SortButton component when sortOptions is not provided' , ( ) => {
194
+ const wrapper = mountWithApp (
195
+ < IndexFilters { ...defaultProps } sortOptions = { undefined } /> ,
196
+ ) ;
197
+
198
+ expect ( wrapper ) . not . toContainReactComponent ( SortButton ) ;
199
+ } ) ;
200
+
201
+ it ( 'renders the SortButton component when sortOptions is provided' , ( ) => {
202
+ const wrapper = mountWithApp ( < IndexFilters { ...defaultProps } /> ) ;
203
+ expect ( wrapper ) . toContainReactComponent ( SortButton ) ;
204
+ } ) ;
205
+
206
+ it ( 'passes zIndexOverride to the SortButton component when provided' , ( ) => {
207
+ const disclosureZIndexOverride = 517 ;
208
+ const wrapper = mountWithApp (
209
+ < IndexFilters
210
+ { ...defaultProps }
211
+ disclosureZIndexOverride = { disclosureZIndexOverride }
212
+ /> ,
213
+ ) ;
214
+
215
+ expect ( wrapper ) . toContainReactComponent ( SortButton , {
216
+ disclosureZIndexOverride,
217
+ } ) ;
168
218
} ) ;
169
219
170
- expect ( defaultProps . onSort ) . toHaveBeenCalledWith ( [ 'customer-name asc' ] ) ;
220
+ it ( 'onSort gets called correctly' , ( ) => {
221
+ const wrapper = mountWithApp ( < IndexFilters { ...defaultProps } /> ) ;
222
+ wrapper . act ( ( ) => {
223
+ wrapper . find ( SortButton ) ! . trigger ( 'onChange' , [ 'customer-name asc' ] ) ;
224
+ } ) ;
225
+
226
+ expect ( defaultProps . onSort ) . toHaveBeenCalledWith ( [ 'customer-name asc' ] ) ;
227
+ } ) ;
171
228
} ) ;
172
229
173
230
describe ( 'filters' , ( ) => {
0 commit comments