修改注册功能问题
This commit is contained in:
@@ -13,6 +13,12 @@ function readPage(fileName) {
|
||||
}
|
||||
|
||||
function run() {
|
||||
const expectedFormIds = {
|
||||
'login.html': ['login-password-form', 'login-sms-form'],
|
||||
'register.html': ['register-form'],
|
||||
'forgot-password.html': ['password-reset-form']
|
||||
};
|
||||
|
||||
pages.forEach((fileName) => {
|
||||
const html = readPage(fileName);
|
||||
const formCaptchaBox = /<form[\s\S]*?data-captcha-box[\s\S]*?<\/form>/i.test(html);
|
||||
@@ -30,8 +36,25 @@ function run() {
|
||||
assert.strictEqual(hasCaptchaModalCss, false, `${fileName} 不应加载自定义验证码样式`);
|
||||
assert.notStrictEqual(layuiScriptIndex, -1, `${fileName} 应加载 layui.js 使用 layer.msg`);
|
||||
assert.ok(layuiScriptIndex < authScriptIndex, `${fileName} 应在 auth-pages.js 之前加载 layui.js`);
|
||||
assert.deepStrictEqual(
|
||||
Array.from(html.matchAll(/<form[^>]*id="([^"]+)"/g)).map((match) => match[1]),
|
||||
expectedFormIds[fileName],
|
||||
`${fileName} 应使用表单 id 作为 JS 挂载点`
|
||||
);
|
||||
assert.strictEqual(/data-auth-form=|data-captcha-scene=|data-success-url=|data-scene-code=|data-login-mode/.test(html), false, `${fileName} 不应把认证业务配置写在 HTML data 属性上`);
|
||||
assert.strictEqual(
|
||||
(html.match(/<input type="hidden" name="validToken" \/>/g) || []).length,
|
||||
expectedFormIds[fileName].length,
|
||||
`${fileName} 每个认证表单都应携带 validToken 隐藏字段`
|
||||
);
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
readPage('register.html').includes('id="register-form"'),
|
||||
true,
|
||||
'register.html 应使用 register-form 挂载注册逻辑'
|
||||
);
|
||||
|
||||
console.log('auth-page-structure tests passed');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user