@@ -58,7 +58,7 @@ describe('FileCriteriaForm', () => {
5858 cy . findByRole ( 'button' , { name : 'Filter Type: All' } ) . should ( 'not.exist' )
5959 cy . findByRole ( 'button' , { name : 'Access: All' } ) . should ( 'not.exist' )
6060 cy . findByRole ( 'button' , { name : 'Filter Tag: All' } ) . should ( 'not.exist' )
61- cy . findByAltText ( 'Search this dataset' ) . should ( 'not.exist' )
61+ cy . findByLabelText ( 'Search this dataset' ) . should ( 'not.exist' )
6262 } )
6363
6464 it ( 'renders the SortBy input' , ( ) => {
@@ -97,7 +97,7 @@ describe('FileCriteriaForm', () => {
9797 />
9898 )
9999
100- cy . findByAltText ( 'Search this dataset' ) . should ( 'exist' )
100+ cy . findByLabelText ( 'Search this dataset' ) . should ( 'exist' )
101101 } )
102102
103103 it ( 'saves global criteria when the sort by option changes' , ( ) => {
@@ -187,4 +187,27 @@ describe('FileCriteriaForm', () => {
187187 cy . findByRole ( 'button' , { name : 'Access: Public' } ) . should ( 'exist' )
188188 cy . findByRole ( 'button' , { name : 'Filter Tag: Data' } ) . should ( 'exist' )
189189 } )
190+
191+ it ( 'saves global criteria when the search input changes' , ( ) => {
192+ const criteria = new FileCriteria ( )
193+ . withFilterByTag ( 'document' )
194+ . withFilterByAccess ( FileAccessOption . PUBLIC )
195+ . withFilterByType ( 'image' )
196+ . withSearchText ( 'search' )
197+
198+ cy . customMount (
199+ < FileCriteriaForm
200+ criteria = { criteria }
201+ onCriteriaChange = { onCriteriaChange }
202+ filesCountInfo = { filesCountInfo }
203+ />
204+ )
205+
206+ cy . findByLabelText ( 'Search this dataset' ) . clear ( ) . type ( 'new search' )
207+
208+ cy . findByRole ( 'button' , { name : 'Filter Type: Image' } ) . should ( 'exist' )
209+ cy . findByRole ( 'button' , { name : 'Access: Public' } ) . should ( 'exist' )
210+ cy . findByRole ( 'button' , { name : 'Filter Tag: Document' } ) . should ( 'exist' )
211+ cy . findByLabelText ( 'Search this dataset' ) . should ( 'have.value' , 'new search' )
212+ } )
190213} )
0 commit comments