家谱现有接口调试50%
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const pages = [
|
||||
'login.html',
|
||||
'register.html',
|
||||
'forgot-password.html'
|
||||
];
|
||||
|
||||
function readPage(fileName) {
|
||||
return fs.readFileSync(path.join(__dirname, '..', fileName), 'utf8');
|
||||
}
|
||||
|
||||
function run() {
|
||||
pages.forEach((fileName) => {
|
||||
const html = readPage(fileName);
|
||||
const formCaptchaBox = /<form[\s\S]*?data-captcha-box[\s\S]*?<\/form>/i.test(html);
|
||||
const pageModalBox = /class="[^"]*\bauth-captcha-modal\b[^"]*"[^>]*data-captcha-box/.test(html)
|
||||
|| /data-captcha-box[^>]*class="[^"]*\bauth-captcha-modal\b[^"]*"/.test(html);
|
||||
const hasLayuiCss = html.includes('href="public/layui/css/layui.css"');
|
||||
const layuiScriptIndex = html.indexOf('src="public/layui/layui.js"');
|
||||
const authScriptIndex = html.indexOf('src="public/js/auth-pages.js"');
|
||||
|
||||
assert.strictEqual(formCaptchaBox, false, `${fileName} 不应把 TAC 挂载点放在表单内部`);
|
||||
assert.strictEqual(pageModalBox, true, `${fileName} 应提供页面级 TAC 弹窗挂载点`);
|
||||
assert.strictEqual(hasLayuiCss, true, `${fileName} 应加载 layui.css 作为 layer 提示样式依赖`);
|
||||
assert.notStrictEqual(layuiScriptIndex, -1, `${fileName} 应加载 layui.js 使用 layer.msg`);
|
||||
assert.ok(layuiScriptIndex < authScriptIndex, `${fileName} 应在 auth-pages.js 之前加载 layui.js`);
|
||||
});
|
||||
|
||||
console.log('auth-page-structure tests passed');
|
||||
}
|
||||
|
||||
run();
|
||||
Reference in New Issue
Block a user