@@ -13,7 +13,6 @@ import { useUserConfigStore } from '../../../store/userconfig.js'
1313
1414vi . mock ( '@nextcloud/l10n' , ( ) => ( {
1515 t : vi . fn ( ( _app : string , text : string ) => text ) ,
16- isRTL : vi . fn ( ( ) => false ) ,
1716} ) )
1817
1918vi . mock ( '@nextcloud/logger' , ( ) => ( {
@@ -115,6 +114,13 @@ vi.mock('../../../views/FilesList/FilesListVirtual.vue', () => ({
115114 } ,
116115} ) )
117116
117+ vi . mock ( '../../../views/FilesList/FileListFilters.vue' , ( ) => ( {
118+ default : {
119+ name : 'FileListFilters' ,
120+ template : '<div class="file-list-filters-stub" />' ,
121+ } ,
122+ } ) )
123+
118124vi . mock ( '../../../components/Request/RequestPicker.vue' , ( ) => ( {
119125 default : {
120126 name : 'RequestPicker' ,
@@ -150,8 +156,8 @@ describe('FilesList.vue rendering rules', () => {
150156 await flushPromises ( )
151157
152158 expect ( wrapper . vm . mdiFolder ) . toBeTruthy ( )
153- expect ( wrapper . vm . mdiViewGrid ) . toBeTruthy ( )
154- expect ( wrapper . vm . mdiViewList ) . toBeTruthy ( )
159+ expect ( wrapper . vm . mdiViewGridOutline ) . toBeTruthy ( )
160+ expect ( wrapper . vm . mdiFormatListBulletedSquare ) . toBeTruthy ( )
155161 expect ( wrapper . vm . mdiChevronDown ) . toBeTruthy ( )
156162 expect ( wrapper . vm . mdiChevronUp ) . toBeTruthy ( )
157163 expect ( wrapper . vm . mdiReload ) . toBeTruthy ( )
@@ -179,6 +185,27 @@ describe('FilesList.vue rendering rules', () => {
179185 expect ( firstChild . classList . contains ( 'request-picker-stub' ) ) . toBe ( true )
180186 } )
181187
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+
182209 it ( 'calls filesStore.updateAllFiles once more when reload button is clicked' , async ( ) => {
183210 const filesStore = useFilesStore ( )
184211 vi . spyOn ( filesStore , 'getAllFiles' ) . mockResolvedValue ( { } )
@@ -238,7 +265,7 @@ describe('FilesList.vue rendering rules', () => {
238265
239266 const gridButton = wrapper . find ( '.files-list__header-grid-button' )
240267 const iconWithPath = gridButton . findAll ( '.nc-icon' ) . find ( ( node ) => ! ! node . attributes ( 'data-path' ) )
241- expect ( iconWithPath ?. attributes ( 'data-path' ) ) . toBe ( wrapper . vm . mdiViewGrid )
268+ expect ( iconWithPath ?. attributes ( 'data-path' ) ) . toBe ( wrapper . vm . mdiViewGridOutline )
242269 } )
243270
244271 it ( 'renders list toggle icon path when in grid mode' , async ( ) => {
@@ -252,6 +279,6 @@ describe('FilesList.vue rendering rules', () => {
252279
253280 const gridButton = wrapper . find ( '.files-list__header-grid-button' )
254281 const iconWithPath = gridButton . findAll ( '.nc-icon' ) . find ( ( node ) => ! ! node . attributes ( 'data-path' ) )
255- expect ( iconWithPath ?. attributes ( 'data-path' ) ) . toBe ( wrapper . vm . mdiViewList )
282+ expect ( iconWithPath ?. attributes ( 'data-path' ) ) . toBe ( wrapper . vm . mdiFormatListBulletedSquare )
256283 } )
257284} )
0 commit comments