This commit is contained in:
2026-08-04 15:31:08 +08:00
parent d5eaa75329
commit ec15a72b0b
14 changed files with 793 additions and 161 deletions
+17
View File
@@ -4,6 +4,7 @@ import test from 'node:test'
const loginSource = readFileSync(new URL('./LoginView.vue', import.meta.url), 'utf8')
const registerSource = readFileSync(new URL('./RegisterView.vue', import.meta.url), 'utf8')
const authShellSource = readFileSync(new URL('../components/AuthShell.vue', import.meta.url), 'utf8')
const legalSource = readFileSync(new URL('./LegalDocumentView.vue', import.meta.url), 'utf8')
const legalDocumentsSource = readFileSync(new URL('../legalDocuments.ts', import.meta.url), 'utf8')
const authRoutesSource = readFileSync(new URL('../routes.ts', import.meta.url), 'utf8')
@@ -12,6 +13,22 @@ const httpSource = readFileSync(new URL('../../../api/http.ts', import.meta.url)
const sessionSource = readFileSync(new URL('../../../api/session.ts', import.meta.url), 'utf8')
const authApiSource = readFileSync(new URL('../api/auth.ts', import.meta.url), 'utf8')
const mainSource = readFileSync(new URL('../../../main.ts', import.meta.url), 'utf8')
const stylesSource = readFileSync(new URL('../../../styles/index.css', import.meta.url), 'utf8')
test('uses one prototype-inspired responsive shell for login and registration', () => {
assert.match(loginSource, /<AuthShell/)
assert.match(registerSource, /<AuthShell/)
assert.match(authShellSource, /auth-ocean\.jpg/)
assert.match(authShellSource, /class="auth-visual"/)
assert.match(stylesSource, /\.auth-panel \{[^}]*grid-template-columns:/s)
assert.match(stylesSource, /@media \(max-width: 960px\)[\s\S]*?\.auth-visual \{ display: none; \}/)
assert.match(stylesSource, /@media \(max-width: 720px\)[\s\S]*?\.register-form-grid \{ grid-template-columns: 1fr; \}/)
})
test('groups the full registration contract without adding out-of-scope sign-in methods', () => {
for (const section of ['账号信息', '企业信息', '联系信息']) assert.match(registerSource, new RegExp(section))
assert.doesNotMatch(loginSource + registerSource, /微信登录|企业微信登录|短信验证码|邮箱验证码|lang-switcher/)
})
test('matches the backend username login contract', () => {
assert.match(loginSource, /label="用户名"/)