browser.spec.ts 820 B

1234567891011121314151617181920212223242526
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import {
  3. generateFingerprint,
  4. setCursorAtTextEnd,
  5. setPastedTextToCurrentSelection,
  6. } from '../browser.ts'
  7. vi.hoisted(() => {
  8. const userAgentSpy = vi.spyOn(window.navigator, 'userAgent', 'get')
  9. userAgentSpy.mockReturnValue(
  10. 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4758.102 Safari/537.36',
  11. )
  12. })
  13. describe('browser', () => {
  14. it('generate fingerprint', () => {
  15. expect(generateFingerprint()).toBe('1613472439')
  16. })
  17. it.todo('sets cursor at the end of the text', () => {
  18. setCursorAtTextEnd(document.createElement('div'))
  19. })
  20. it.todo('sets pasted text to current selection', () => {
  21. setPastedTextToCurrentSelection(new ClipboardEvent('paste'))
  22. })
  23. })