|
|
|
@@ -173,6 +173,7 @@ test('clicking a notification uses the legacy exit class and removal delay', ()
|
|
|
|
|
test('notyf CSS and WordPress enqueue match the reference contract', () => {
|
|
|
|
|
const css = read('assets/css/frontend/notyf.css');
|
|
|
|
|
const scripts = read('src/Core/ScriptsPart1c.php');
|
|
|
|
|
const builder = read('tools/build-public-assets.mjs');
|
|
|
|
|
|
|
|
|
|
assert.match(css, /\.notyn\s*\{[\s\S]*?bottom:\s*6em;[\s\S]*?max-width:\s*320px;[\s\S]*?z-index:\s*10000000;/);
|
|
|
|
|
assert.match(css, /\.notyf\s*\{[\s\S]*?position:\s*relative;[\s\S]*?font-size:\s*14px;[\s\S]*?line-height:\s*1\.42857143;[\s\S]*?min-width:\s*200px;[\s\S]*?padding:\s*1em 3em 1em 3\.4em;/);
|
|
|
|
@@ -188,9 +189,9 @@ test('notyf CSS and WordPress enqueue match the reference contract', () => {
|
|
|
|
|
assert.match(css, /content:\s*'\\f057'/);
|
|
|
|
|
assert.match(css, /\.notyf\.load::before[\s\S]*?huan-rotate 1s/);
|
|
|
|
|
|
|
|
|
|
assert.match(scripts, /'aksrt-notyf',[\s\S]*?'\/assets\/js\/notyf\.js',[\s\S]*?\['jquery'\]/);
|
|
|
|
|
assert.match(scripts, /'aksrt-runtime',[\s\S]*?\['aksrt-rehydrate', 'aksrt-notyf'\]/);
|
|
|
|
|
assert.match(scripts, /'\/assets\/css\/frontend\/notyf\.css',[\s\S]*?'_fontawesome'/);
|
|
|
|
|
assert.match(builder, /assets\/js\/notyf\.js/);
|
|
|
|
|
assert.match(builder, /assets\/css\/frontend\/notyf\.css/);
|
|
|
|
|
assert.match(scripts, /'aksrt-runtime',[\s\S]*?'\/assets\/js\/build\/public\.js',[\s\S]*?\['loader_js'\]/);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('balance center actions use direct fixed-id notyf flows', () => {
|
|
|
|
@@ -242,8 +243,8 @@ test('balance center actions use direct fixed-id notyf flows', () => {
|
|
|
|
|
assert.doesNotMatch(credits, /function initSignin\(|\/signin\/today|POST \/signin/);
|
|
|
|
|
assert.match(signinController, /aksrtSigninInitialized/);
|
|
|
|
|
assert.match(credits, /aksrtPointsExchangeInitialized[\s\S]*?aksrtWithdrawInitialized/);
|
|
|
|
|
assert.match(scripts, /'aksrt-credits',[\s\S]*?\/assets\/js\/credits\.js',[\s\S]*?\[[^\]]*'aksrt-notyf'[^\]]*\]/);
|
|
|
|
|
assert.match(scripts, /\$signin_on\s*=\s*is_user_logged_in\(\)[\s\S]*?'aksrt-signin',[\s\S]*?\/assets\/js\/signin\.js',[\s\S]*?'aksrt-core-request'[\s\S]*?'aksrt-notyf'/);
|
|
|
|
|
assert.match(scripts, /'aksrt-credits',[\s\S]*?\/assets\/js\/credits\.js',[\s\S]*?\[[^\]]*'aksrt-runtime'[^\]]*\]/);
|
|
|
|
|
assert.match(scripts, /\$signin_on\s*=\s*is_user_logged_in\(\)[\s\S]*?'aksrt-signin',[\s\S]*?\/assets\/js\/signin\.js',[\s\S]*?'aksrt-runtime'/);
|
|
|
|
|
assert.ok(header.indexOf('data-signin-btn') < header.indexOf('uc-header__message-btn'));
|
|
|
|
|
assert.match(header, /uc-header__message-btn[^>]+aria-label="<\?php esc_attr_e\('消息通知'/);
|
|
|
|
|
assert.doesNotMatch(header, /<i class="fa fas fa-bell"[^>]*><\/i>\s*<\?php esc_html_e\('消息通知'/);
|
|
|
|
@@ -282,7 +283,7 @@ test('VIP purchase and points exchange use direct fixed-id notyf flows', () => {
|
|
|
|
|
|
|
|
|
|
assert.doesNotMatch(vip, /setTip|aksrt-vip-modal-tip/);
|
|
|
|
|
assert.doesNotMatch(css, /\.aksrt-vip-modal-tip/);
|
|
|
|
|
assert.match(scripts, /'aksrt-pay-vip',[\s\S]*?\/assets\/js\/pay-vip\.js',[\s\S]*?\[[^\]]*'aksrt-notyf'[^\]]*\]/);
|
|
|
|
|
assert.match(scripts, /'aksrt-pay-vip',[\s\S]*?\/assets\/js\/pay-vip\.js',[\s\S]*?\[[^\]]*'aksrt-runtime'[^\]]*\]/);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('payment entry points never load the removed legacy pay runtime', () => {
|
|
|
|
@@ -324,7 +325,7 @@ test('profile save uses AJAX rehydrate and a fixed-id notyf flow without query f
|
|
|
|
|
assert.match(profile, /notyf\([^;]+?'success'[^;]+?'aksrt-profile-save-toast'\);/);
|
|
|
|
|
assert.match(profile, /notyf\([^;]+?'danger'[^;]+?'aksrt-profile-save-toast'\);/);
|
|
|
|
|
assert.match(profile, /fetch\(ajaxUrl, \{ method: 'POST', credentials: 'same-origin', body: data \}\)/);
|
|
|
|
|
assert.match(scripts, /\$user_center_deps[\s\S]*?\[[^\]]*'aksrt-notyf'[^\]]*\][\s\S]*?\/assets\/js\/routes\/user-center\.js/);
|
|
|
|
|
assert.match(scripts, /\$user_center_deps[\s\S]*?\[[^\]]*'aksrt-runtime'[^\]]*\][\s\S]*?\/assets\/js\/routes\/user-center\.js/);
|
|
|
|
|
|
|
|
|
|
assert.doesNotMatch(page, /REQUEST_METHOD|profile_error|['"]saved['"]|add_query_arg/);
|
|
|
|
|
assert.doesNotMatch([profile, form, layout, lists].join('\n'), /profile-save-msg|profile-form__submit-msg/);
|
|
|
|
@@ -401,7 +402,7 @@ test('front submit actions use direct fixed-id notyf flows', () => {
|
|
|
|
|
assert.match(submit, /needContent[^;]+?'warning'/);
|
|
|
|
|
assert.doesNotMatch(submit, /\b(?:window\.)?alert\s*\(/);
|
|
|
|
|
|
|
|
|
|
assert.match(page, /'aksrt-front-submit',[\s\S]*?'\/assets\/js\/front-submit\.js',[\s\S]*?\[[^\]]*'aksrt-notyf'[^\]]*\]/);
|
|
|
|
|
assert.match(page, /'aksrt-front-submit',[\s\S]*?'\/assets\/js\/front-submit\.js',[\s\S]*?\[[^\]]*'aksrt-runtime'[^\]]*\]/);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('legacy frontend toast APIs and selectors are fully removed', () => {
|
|
|
|
@@ -409,7 +410,7 @@ test('legacy frontend toast APIs and selectors are fully removed', () => {
|
|
|
|
|
'assets/js',
|
|
|
|
|
'assets/css/frontend',
|
|
|
|
|
'assets/css/routes',
|
|
|
|
|
'assets/css/build/frontend-base.min.css.disabled',
|
|
|
|
|
'assets/css/build',
|
|
|
|
|
'page.php',
|
|
|
|
|
'templates/pages/page-profile.php',
|
|
|
|
|
];
|
|
|
|
|