杂务:新增声明级注释覆盖率
This commit is contained in:
@@ -2,6 +2,10 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { createApp } from 'vue'
|
||||
import { useGlobalConfirmEnter } from './useConfirmEnter'
|
||||
|
||||
/**
|
||||
* Purpose: visibleRects supports useConfirmEnter.test.ts by holding or executing the visible rects page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const visibleRects = [{
|
||||
bottom: 100,
|
||||
height: 100,
|
||||
@@ -14,10 +18,18 @@ const visibleRects = [{
|
||||
toJSON: () => ({})
|
||||
}] as DOMRect[]
|
||||
|
||||
/**
|
||||
* Purpose: makeVisible supports useConfirmEnter.test.ts by holding or executing the make visible page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const makeVisible = (element: HTMLElement) => {
|
||||
vi.spyOn(element, 'getClientRects').mockReturnValue(visibleRects as unknown as DOMRectList)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: setDesktopViewport supports useConfirmEnter.test.ts by holding or executing the set desktop viewport page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const setDesktopViewport = () => {
|
||||
Object.defineProperty(window, 'innerWidth', {
|
||||
configurable: true,
|
||||
@@ -35,6 +47,10 @@ const setDesktopViewport = () => {
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: setMobileViewport supports useConfirmEnter.test.ts by holding or executing the set mobile viewport page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const setMobileViewport = () => {
|
||||
Object.defineProperty(window, 'innerWidth', {
|
||||
configurable: true,
|
||||
@@ -42,6 +58,10 @@ const setMobileViewport = () => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: setCoarsePointer supports useConfirmEnter.test.ts by holding or executing the set coarse pointer page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const setCoarsePointer = () => {
|
||||
Object.defineProperty(window, 'innerWidth', {
|
||||
configurable: true,
|
||||
@@ -59,6 +79,10 @@ const setCoarsePointer = () => {
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: mountGlobalConfirmEnter supports useConfirmEnter.test.ts by holding or executing the mount global confirm enter page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const mountGlobalConfirmEnter = () => {
|
||||
const host = document.createElement('div')
|
||||
document.body.appendChild(host)
|
||||
@@ -78,6 +102,10 @@ const mountGlobalConfirmEnter = () => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: createModal supports useConfirmEnter.test.ts by holding or executing the create modal page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const createModal = ({
|
||||
zIndex = 1000,
|
||||
buttonClass = '',
|
||||
@@ -119,12 +147,20 @@ const createModal = ({
|
||||
return { wrap, button, click, onClick }
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: createKeyboardEvent supports useConfirmEnter.test.ts by holding or executing the create keyboard event page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const createKeyboardEvent = () => new KeyboardEvent('keydown', {
|
||||
key: 'Enter',
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
})
|
||||
|
||||
/**
|
||||
* Purpose: pressEnter supports useConfirmEnter.test.ts by holding or executing the press enter page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const pressEnter = (target: EventTarget = document) => {
|
||||
const event = createKeyboardEvent()
|
||||
target.dispatchEvent(event)
|
||||
|
||||
Reference in New Issue
Block a user