2026-05-09 08:25:54 +00:00
|
|
|
import assert from 'node:assert/strict'
|
|
|
|
|
import { readFileSync } from 'node:fs'
|
|
|
|
|
|
2026-06-24 12:35:59 +08:00
|
|
|
const settingsModel = readFileSync(new URL('../src/utils/settingsModelHelper.js', import.meta.url), 'utf8')
|
2026-05-09 08:25:54 +00:00
|
|
|
const settingsView = readFileSync(new URL('../src/views/SettingsView.vue', import.meta.url), 'utf8')
|
|
|
|
|
const settingsStyles = readFileSync(new URL('../src/assets/styles/views/settings-view.css', import.meta.url), 'utf8')
|
|
|
|
|
|
|
|
|
|
function testRenderingSectionUsesConciseToolbarTitle() {
|
2026-06-24 12:35:59 +08:00
|
|
|
assert.match(settingsModel, /title:\s*'文件渲染'/)
|
|
|
|
|
assert.doesNotMatch(settingsModel, /title:\s*'ONLYOFFICE 文件渲染配置'/)
|
2026-05-09 08:25:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function testRenderingCardRemovesDuplicatedDescription() {
|
|
|
|
|
assert.match(settingsView, /<h4>ONLYOFFICE 服务配置<\/h4>/)
|
|
|
|
|
assert.doesNotMatch(settingsView, /维护文件渲染开关、文档服务对外地址和 JWT 密钥。后端回调地址继续由部署配置管理。/)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function testRenderingSectionAddsSpacingBetweenSwitchAndInputs() {
|
|
|
|
|
assert.match(settingsView, /<section class="settings-card rendering-settings-card">/)
|
|
|
|
|
assert.match(settingsStyles, /\.rendering-settings-card \.switch-group \{\s*margin-bottom: 24px;\s*\}/)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function run() {
|
|
|
|
|
testRenderingSectionUsesConciseToolbarTitle()
|
|
|
|
|
testRenderingCardRemovesDuplicatedDescription()
|
|
|
|
|
testRenderingSectionAddsSpacingBetweenSwitchAndInputs()
|
|
|
|
|
console.log('settings rendering section tests passed')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
run()
|