(
props: InstanceType<typeof Captcha>['$props'] = {},
slots: any = {},
)
| 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) { |
no test coverage detected