Skip to content

Commit 68f64fb

Browse files
test(files-list): update grid toggle icon tests and remove obsolete ListViewIcon stub
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 438295e commit 68f64fb

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

src/tests/views/FilesList/FilesList.spec.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,6 @@ describe('FilesList.vue rendering rules', () => {
127127
mocks: {
128128
$route: routeMock,
129129
},
130-
stubs: {
131-
ListViewIcon: {
132-
template: '<i class="list-view-icon" />',
133-
},
134-
},
135130
},
136131
})
137132
}
@@ -145,6 +140,7 @@ describe('FilesList.vue rendering rules', () => {
145140

146141
expect(wrapper.vm.mdiFolder).toBeTruthy()
147142
expect(wrapper.vm.mdiViewGrid).toBeTruthy()
143+
expect(wrapper.vm.mdiViewList).toBeTruthy()
148144
})
149145

150146
it('shows empty-state request action when user can request sign', async () => {
@@ -193,4 +189,17 @@ describe('FilesList.vue rendering rules', () => {
193189
const iconWithPath = wrapper.findAll('.nc-icon').find((node) => !!node.attributes('data-path'))
194190
expect(iconWithPath?.attributes('data-path')).toBe(wrapper.vm.mdiViewGrid)
195191
})
192+
193+
it('renders list toggle icon path when in grid mode', async () => {
194+
const filesStore = useFilesStore()
195+
const userConfigStore = useUserConfigStore()
196+
vi.spyOn(filesStore, 'getAllFiles').mockResolvedValue({})
197+
userConfigStore.files_list_grid_view = true
198+
199+
const wrapper = mountComponent()
200+
await flushPromises()
201+
202+
const iconWithPath = wrapper.findAll('.nc-icon').find((node) => !!node.attributes('data-path'))
203+
expect(iconWithPath?.attributes('data-path')).toBe(wrapper.vm.mdiViewList)
204+
})
196205
})

0 commit comments

Comments
 (0)