feat: 同步质量校验修复并精简工作台操作
This commit is contained in:
@@ -1,6 +1,22 @@
|
||||
import { flushPromises, type VueWrapper } from '@vue/test-utils'
|
||||
import { NSelect } from 'naive-ui'
|
||||
|
||||
/** 通过真实菜单触发器访问低频功能,不直接调用组件内部方法绕过可见性。 */
|
||||
export async function selectMenu(label: string, option: string) {
|
||||
const trigger = [...document.querySelectorAll<HTMLButtonElement>('button')].find(
|
||||
item => item.getAttribute('aria-label') === label
|
||||
)
|
||||
if (!trigger) throw new Error('找不到菜单:' + label)
|
||||
trigger.click()
|
||||
await flushPromises()
|
||||
const item = [...document.querySelectorAll<HTMLElement>('.n-dropdown-option-body')].find(
|
||||
candidate => candidate.textContent?.trim() === option
|
||||
)
|
||||
if (!item) throw new Error('找不到菜单项:' + option)
|
||||
item.click()
|
||||
await flushPromises()
|
||||
}
|
||||
|
||||
/** 展开真实折叠面板后再测试内部操作,避免对不可见控件进行断言。 */
|
||||
export async function expandSections() {
|
||||
const tools = document.querySelector<HTMLElement>('[data-workspace-tools][aria-expanded="false"]')
|
||||
|
||||
Reference in New Issue
Block a user