@@ -114,6 +114,13 @@ vi.mock('../../../views/FilesList/FilesListVirtual.vue', () => ({
114114 } ,
115115} ) )
116116
117+ vi . mock ( '../../../views/FilesList/FileListFilters.vue' , ( ) => ( {
118+ default : {
119+ name : 'FileListFilters' ,
120+ template : '<div class="file-list-filters-stub" />' ,
121+ } ,
122+ } ) )
123+
117124vi . mock ( '../../../components/Request/RequestPicker.vue' , ( ) => ( {
118125 default : {
119126 name : 'RequestPicker' ,
@@ -178,6 +185,27 @@ describe('FilesList.vue rendering rules', () => {
178185 expect ( firstChild . classList . contains ( 'request-picker-stub' ) ) . toBe ( true )
179186 } )
180187
188+ it ( 'renders FileListFilters in the header before the grid toggle button' , async ( ) => {
189+ const filesStore = useFilesStore ( )
190+ vi . spyOn ( filesStore , 'getAllFiles' ) . mockResolvedValue ( { } )
191+
192+ const wrapper = mountComponent ( )
193+ await flushPromises ( )
194+
195+ const header = wrapper . find ( '.files-list__header' )
196+ const filterStub = header . find ( '.file-list-filters-stub' )
197+ const gridButton = header . find ( '.files-list__header-grid-button' )
198+
199+ expect ( filterStub . exists ( ) ) . toBe ( true )
200+ expect ( gridButton . exists ( ) ) . toBe ( true )
201+
202+ // FileListFilters must appear before the grid button in the DOM
203+ const children = Array . from ( header . element . children )
204+ const filterIndex = children . findIndex ( el => el . classList . contains ( 'file-list-filters-stub' ) )
205+ const gridIndex = children . findIndex ( el => el . classList . contains ( 'files-list__header-grid-button' ) )
206+ expect ( filterIndex ) . toBeLessThan ( gridIndex )
207+ } )
208+
181209 it ( 'calls filesStore.updateAllFiles once more when reload button is clicked' , async ( ) => {
182210 const filesStore = useFilesStore ( )
183211 vi . spyOn ( filesStore , 'getAllFiles' ) . mockResolvedValue ( { } )
0 commit comments