修复了一些问题
This commit is contained in:
1 parent
c484ee6ef3
commit
e877ceb560
28 files changed
+565
-535
No files matched your search
@@ -34,3 +34,33 @@ test('front submit uses the WordPress registered jQuery runtime', () => {
|
||||
assert.doesNotMatch(source, /jquery-migrate/);
|
||||
assert.doesNotMatch(source, /runtime\/libs\/jquery\.min\.js|['"]1\.9\.1['"]/);
|
||||
});
|
||||
|
||||
test('legacy runtime modules use jQuery explicitly without a dollar alias', () => {
|
||||
const modules = [
|
||||
'main',
|
||||
'captcha',
|
||||
'comment',
|
||||
'input-expand',
|
||||
'mini-touch',
|
||||
'mini-upload',
|
||||
'page-edit',
|
||||
'page-navs',
|
||||
'page-template',
|
||||
'poster-share',
|
||||
'section-navs',
|
||||
'svg-icon',
|
||||
'waterfall',
|
||||
'weixin-share',
|
||||
];
|
||||
|
||||
for (const module of modules) {
|
||||
for (const suffix of ['.js', '.min.js']) {
|
||||
const relative = `assets/js/runtime/${module}${suffix}`;
|
||||
const absolute = path.join(root, relative);
|
||||
if (!fs.existsSync(absolute) || fs.statSync(absolute).size === 0) continue;
|
||||
const source = fs.readFileSync(absolute, 'utf8');
|
||||
assert.doesNotMatch(source, /(^|[^\w$])\$(?:\(|\.)/, `${relative} must use jQuery explicitly`);
|
||||
assert.doesNotMatch(source, /(?:window\.)?\$\s*=/, `${relative} must not create a dollar alias`);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user