fix: preserve tenant in participant links
Build invitation and meeting URLs from the validated tenant origin and fall back when local HTTP blocks the Clipboard API. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
98f47df8c1
commit
314c783659
10 changed files with 117 additions and 21 deletions
23
frontend/src/components/actions/copyText.test.ts
Normal file
23
frontend/src/components/actions/copyText.test.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { afterEach, expect, it, vi } from 'vitest'
|
||||
import { copyText } from './copyText'
|
||||
|
||||
const originalExecCommand = Object.getOwnPropertyDescriptor(document, 'execCommand')
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
if (originalExecCommand) {
|
||||
Object.defineProperty(document, 'execCommand', originalExecCommand)
|
||||
} else {
|
||||
Reflect.deleteProperty(document, 'execCommand')
|
||||
}
|
||||
})
|
||||
|
||||
it('falls back to a selected textarea when the Clipboard API is unavailable', async () => {
|
||||
const copy = vi.fn().mockReturnValue(true)
|
||||
Object.defineProperty(document, 'execCommand', { configurable: true, value: copy })
|
||||
|
||||
await copyText('http://ypto.guess.local:5173/participant/token')
|
||||
|
||||
expect(copy).toHaveBeenCalledWith('copy')
|
||||
expect(document.querySelector('textarea')).toBeNull()
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue