MCPcopy
hub / github.com/vexip-ui/vexip-ui / createSlideCaptcha

Function createSlideCaptcha

components/captcha/tests/captcha.spec.tsx:49–80  ·  view source on GitHub ↗
(
    props: InstanceType<typeof Captcha>['$props'] = {},
    slots: any = {},
  )

Source from the content-addressed store, hash-verified

47 let wrapper: ReturnType<typeof mount> | null
48
49 async function createSlideCaptcha(
50 props: InstanceType<typeof Captcha>['$props'] = {},
51 slots: any = {},
52 ) {
53 vi.useRealTimers()
54
55 wrapper = mount(Captcha, { props: { image: IMAGE, ...props, type: 'slide' }, slots })
56 const trigger = wrapper.find('.vxp-captcha__trigger')
57
58 await nextFrame()
59 await trigger.trigger('transitionend')
60 await nextTick()
61
62 vi.useFakeTimers()
63
64 const trackEl = wrapper.find('.vxp-captcha__track').element
65 mocked.push(
66 vi.spyOn(trackEl, 'getBoundingClientRect').mockImplementation(() => ({
67 x: 0,
68 y: 0,
69 top: 0,
70 left: 0,
71 width: 100,
72 height: 100,
73 right: 0,
74 bottom: 0,
75 toJSON: noop,
76 })),
77 )
78
79 return wrapper
80 }
81
82 async function toggleMove(value = 100, el = wrapper) {
83 if (el) {

Callers 1

captcha.spec.tsxFile · 0.85

Calls 2

nextFrameFunction · 0.70
mountFunction · 0.50

Tested by

no test coverage detected