Skip to content

Commit b5c0365

Browse files
test(files-list): add tests for header restructure and reload button
Signed-off-by: Vitor Mattos <[email protected]> [skip ci]
1 parent 45b71c4 commit b5c0365

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,17 @@ vi.mock('@nextcloud/vue/components/NcAppContent', () => ({
7474
default: { name: 'NcAppContent', template: '<div><slot /></div>' },
7575
}))
7676
vi.mock('@nextcloud/vue/components/NcBreadcrumb', () => ({
77-
default: { name: 'NcBreadcrumb', template: '<div><slot name="icon" /></div>' },
77+
default: {
78+
name: 'NcBreadcrumb',
79+
template: '<div><slot name="icon" /><slot name="menu-icon" /><slot /></div>',
80+
},
81+
}))
82+
vi.mock('@nextcloud/vue/components/NcActionButton', () => ({
83+
default: {
84+
name: 'NcActionButton',
85+
emits: ['click'],
86+
template: '<button class="nc-action-button-stub" @click="$emit(\'click\')"><slot /></button>',
87+
},
7888
}))
7989
vi.mock('@nextcloud/vue/components/NcBreadcrumbs', () => ({
8090
default: { name: 'NcBreadcrumbs', template: '<div><slot /><slot name="actions" /></div>' },
@@ -190,7 +200,8 @@ describe('FilesList.vue rendering rules', () => {
190200
const wrapper = mountComponent()
191201
await flushPromises()
192202

193-
const iconWithPath = wrapper.findAll('.nc-icon').find((node) => !!node.attributes('data-path'))
203+
const gridButton = wrapper.find('.files-list__header-grid-button')
204+
const iconWithPath = gridButton.findAll('.nc-icon').find((node) => !!node.attributes('data-path'))
194205
expect(iconWithPath?.attributes('data-path')).toBe(wrapper.vm.mdiViewGrid)
195206
})
196207
})

0 commit comments

Comments
 (0)