Skip to content

Commit 427e447

Browse files
committed
test(frontend): verify dialogs 8 toasts and PDF file picker contract
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent f931794 commit 427e447

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

‎src/tests/utils/dialogs-v8.spec.ts‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2026 LibreSign contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
6+
import { describe, expect, it } from 'vitest'
7+
import { nextTick } from 'vue'
8+
import { getFilePickerBuilder, showError, showSuccess, showWarning } from '@nextcloud/dialogs'
9+
10+
describe('dialogs v8 integration', () => {
11+
it.each([
12+
['success', showSuccess, 'status'],
13+
['warning', showWarning, 'status'],
14+
['error', showError, 'alert'],
15+
] as const)('renders and dismisses a %s toast', async (type, showToast, role) => {
16+
const message = `LibreSign ${type} feedback`
17+
const toast = showToast(message, { timeout: -1 })
18+
await nextTick()
19+
const notification = [...document.querySelectorAll(`[role="${role}"]`)]
20+
.find(element => element.textContent?.includes(message))
21+
expect(notification).toBeDefined()
22+
toast.hideToast()
23+
await nextTick()
24+
expect(notification?.isConnected).toBe(false)
25+
})
26+
27+
it('provides the file picker API used by LibreSign', () => {
28+
const picker = getFilePickerBuilder('Select your file')
29+
.setMultiSelect(false)
30+
.setMimeTypeFilter(['application/pdf'])
31+
.addButton({ label: 'Choose', callback: () => undefined })
32+
.build()
33+
expect(typeof picker.pick).toBe('function')
34+
})
35+
})

0 commit comments

Comments
 (0)