精简配置表单重复标题说明并完成浏览器验收
Security Checks / security (push) Waiting to run

This commit is contained in:
xuans committed 2026-09-06 14:48:42 +08:00
1 parent 042dd589fa
commit b61c4c9479
6 files changed
+47 -52

No files matched your search

+21
View File
@@ -32,6 +32,27 @@ test('五个分区使用分组表单,控件和样式能编译且不再提供 J
}
})
test('分组不显示重复标题和介绍,保留无障碍名称、凭据状态及异常提示', () => {
const template = readFileSync(new URL('ConfigForm/ConfigForm.vue', root), 'utf8')
const css = readFileSync(new URL('ConfigForm/ConfigForm.css', root), 'utf8')
assert.doesNotMatch(template, /<h[1-6]\b|form-group-heading|form-group-description|group\.description/)
assert.doesNotMatch(template, /aria-labelledby/)
assert.match(template, /<section\b[^>]*:aria-label="group.title"/)
assert.match(template, /v-if="section === 'plugins'" class="credential-status"/)
assert.match(template, /group.secretConfigured \? '凭据已配置' : '未配置凭据'/)
assert.match(template, /v-if="group.note" class="form-group-note" role="note"/)
assert.match(template, /v-if="!groups.length" class="form-empty"/)
assert.match(template, /<ConfigField\b/)
for (const binding of ['v-for="field in group.fields"', ':value="getValue(config, field.path)"', ':error="errors[fieldKey(field)]"', ':disabled="disabled"', "emit('change', path, value)"]) {
assert.ok(template.includes(binding))
}
assert.doesNotMatch(css, /form-group-heading|form-group-description/)
const formStyle = css.match(/\.config-form\s*\{([^}]+)\}/)?.[1] || ''
assert.doesNotMatch(formStyle, /margin-top|padding-top/)
assert.match(css, /\.config-form:not\(:first-child\)\s*\{\s*margin-top: 16px;/)
assert.match(css, /\.form-group \+ \.form-group\s*\{[^}]*border-top:/)
})
test('单字段更新完整保留内部数据,锁定字段和污染路径无法写入', () => {
const config = {
generation: 8, schemaVersion: 2, database: { type: 'sqlite', localRef: 'test.db', password: null },
+14
View File
@@ -339,6 +339,20 @@ test('配置编辑页移除步骤提示条和专用样式,保留实际操作
assert.match(template, /@click="managePending\('cancel'\)"/)
})
test('配置编辑区移除填写标题、说明与重复标签,保留主标题和必要提示', () => {
const root = new URL('../../frontend/src/views/components/ConfigSettings/', import.meta.url)
const template = readFileSync(new URL('ConfigEditor/ConfigEditor.vue', root), 'utf8')
const css = readFileSync(new URL('ConfigSettings.css', root), 'utf8')
assert.doesNotMatch(template, /'填写配置'|'查看配置'|按分组填写内容|当前页面的脱敏配置内容|panel-heading|selected-section-label/)
assert.doesNotMatch(css, /selected-section-label/)
assert.match(template, /<h3 id="config-page-title">{{ currentSection.label }}/)
assert.match(template, /v-if="selectedSection === 'ssl' && status.tlsMode === 'proxy'"[^>]*role="note"/)
assert.match(template, /v-if="sectionError"[\s\S]*?:title="sectionError"/)
assert.match(template, /<p id="config-sensitive-hint"/)
assert.match(template, /v-if="secretField" class="secret-editor"/)
assert.match(template, /v-if="validationResult"[^>]*role="status"/)
})
test('离开、刷新和正在执行的变更受保护,取消时保留编辑内容', async () => {
let cancel = true
let prompts = 0