拆分插件三级配置菜单并统一三插件构建打包
Security Checks / security (push) Waiting to run

This commit is contained in:
xuans committed 2026-09-06 16:22:38 +08:00
1 parent 7d0e84a381
commit 4ea3a39e41
20 files changed
+486 -66

No files matched your search

+23 -1
View File
@@ -18,10 +18,20 @@ function fixture(capabilities = ['config.read']) {
return { page, allowed }
}
test('七个菜单对应七个不同页面组件,无权限的维护入口不可打开', async () => {
test('配置菜单包含三个独立插件三级页面,无权限的维护入口不可打开', async () => {
const { page, allowed } = fixture()
assert.equal(new Set(page.sectionOptions.value.map(item => item.component)).size, 7)
assert.deepEqual(page.sectionOptions.value.map(item => item.value), ['base', 'smtp', 'imap', 'pop3', 'email', 'ssl', 'plugins'])
const children = page.sectionOptions.value.find(item => item.value === 'plugins').children
assert.deepEqual(children.map(item => item.value), ['spam_block', 'telegram_push', 'wechat_push'])
await page.selectSection('plugins')
assert.equal(page.selectedSection.value, 'spam_block')
assert.equal(page.activePage.value.label, '垃圾邮件拦截')
await page.selectSection('telegram_push')
assert.equal(page.activePage.value.label, 'Telegram 推送')
await page.selectSection('plugins')
assert.equal(page.selectedSection.value, 'telegram_push')
await page.selectSection('base')
assert.equal(page.maintenanceOptions.value.length, 0)
await page.selectSection('audit')
await page.selectSection('invalid')
@@ -34,6 +44,18 @@ test('七个菜单对应七个不同页面组件,无权限的维护入口不
assert.equal(page.activePage.value, undefined)
})
test('插件三级菜单切换保留离开确认及权限检查', async () => {
const { page, allowed } = fixture()
await page.selectSection('wechat_push')
page.currentPage.value = { beforeLeave: async () => false }
await page.selectSection('spam_block')
assert.equal(page.selectedSection.value, 'wechat_push')
page.currentPage.value = { beforeLeave: async () => { allowed.delete('config.read'); return true } }
await page.selectSection('telegram_push')
assert.equal(page.selectedSection.value, 'wechat_push')
assert.equal(page.activePage.value, undefined)
})
test('切页等待离开确认,取消和快速重复点击不会更改页面', async () => {
const { page } = fixture()
let resolve