test(navigation): 契约断言对齐打包后的运行时架构
- 依赖图测试:jquery deregister/单文件注册断言改为断言 jquery-core 收敛、 aksrt-runtime 指向 public.js,以及打包工具纳入 bootstrap/fontawesome5/ main.min.css/loader/main.min - header DOM 测试:移除已废弃的 nav_user_newposts_btn 与 navbar-but 断言, 改断言 navbar-newposts 与 header-userbox.css 进入 public.css 打包清单
This commit is contained in:
@@ -38,13 +38,19 @@ const header = join([
|
||||
]);
|
||||
|
||||
test('the public dependency graph is the single local runtime stack', () => {
|
||||
assert.match(scripts, /wp_deregister_script\('jquery'\)/);
|
||||
assert.match(scripts, /jquery\.min\.js'[\s\S]*?'1\.9\.1'/);
|
||||
assert.match(scripts, /bootstrap\.min\.css'[\s\S]*?'3\.4\.1'/);
|
||||
assert.match(scripts, /fontawesome5'[\s\S]*?all\.min\.css'[\s\S]*?'5\.15\.4'/);
|
||||
assert.match(scripts, /main\.min\.css/);
|
||||
assert.match(scripts, /loader\.js'[\s\S]*?\['jquery', 'bootstrap'\]/);
|
||||
assert.match(read('assets/js/runtime/loader.js'), /tbquire\(\['main'\]\)/);
|
||||
const buildTool = read('tools/build-public-assets.mjs');
|
||||
|
||||
assert.match(scripts, /registered\['jquery'\]->deps = \['jquery-core'\]/);
|
||||
assert.match(scripts, /wp_enqueue_script\('jquery'\)/);
|
||||
assert.doesNotMatch(scripts, /wp_deregister_script\('jquery'\)/);
|
||||
assert.match(scripts, /'aksrt-runtime'/);
|
||||
assert.match(scripts, /assets\/js\/build\/public\.js/);
|
||||
assert.match(buildTool, /assets\/css\/bootstrap\.min\.css/);
|
||||
assert.match(buildTool, /assets\/fontawesome5\/css\/all\.min\.css/);
|
||||
assert.match(buildTool, /assets\/css\/main\.min\.css/);
|
||||
assert.match(buildTool, /assets\/js\/runtime\/libs\/bootstrap\.min\.js/);
|
||||
assert.match(buildTool, /assets\/js\/runtime\/loader\.js/);
|
||||
assert.match(buildTool, /assets\/js\/runtime\/main\.min\.js/);
|
||||
for (const file of [
|
||||
'assets/js/runtime/libs/jquery.min.js',
|
||||
'assets/js/runtime/libs/bootstrap.min.js',
|
||||
@@ -146,16 +152,17 @@ test('mobile navigation is one setting-driven left right or top drawer', () => {
|
||||
|
||||
test('guest account member VIP and publish contracts share reference header DOM', () => {
|
||||
const userboxCss = read('assets/css/frontend/header-userbox.css');
|
||||
const buildTool = read('tools/build-public-assets.mjs');
|
||||
|
||||
assert.match(header, /is_user_logged_in\(\)/);
|
||||
assert.match(header, /sub-user-box aksrt-header-userbox/);
|
||||
assert.match(header, /signin-loader|signin/);
|
||||
assert.match(header, /get_payment_vip_settings/);
|
||||
assert.match(header, /nav_user_newposts_btn/);
|
||||
assert.match(header, /navbar-newposts/);
|
||||
assert.match(header, /nav_newposts/);
|
||||
assert.match(header, /navbar-form navbar-right navbar-but/);
|
||||
assert.match(header, /navbar-form navbar-right/);
|
||||
assert.match(header, /pay-vip/);
|
||||
assert.match(scripts, /\$enqueue_module\('header-userbox'\)/);
|
||||
assert.match(buildTool, /assets\/css\/frontend\/header-userbox\.css/);
|
||||
assert.match(userboxCss, /\.aksrt-header-userbox \.user-info > \.avatar/);
|
||||
assert.match(userboxCss, /\.aksrt-header-wallet/);
|
||||
assert.match(userboxCss, /\.aksrt-header-checkin/);
|
||||
|
||||
Reference in New Issue
Block a user