fix(frontend): keep asset and homepage filters in DOM
This commit is contained in:
@@ -99,6 +99,29 @@ test('routed modules use one namespaced auto_fun owner and no registry', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('user center navigation initializes once across auto_fun rescans', () => {
|
||||
const source = read('assets/js/routes/user-center.js');
|
||||
const initAt = source.indexOf('function initDashboardNavigation()');
|
||||
const guardAt = source.indexOf('aksrtUserCenterNavigationInitialized', initAt);
|
||||
const initialActivateAt = source.indexOf('activate(initialTab, false)', initAt);
|
||||
|
||||
assert.ok(initAt >= 0);
|
||||
assert.ok(guardAt > initAt && guardAt < initialActivateAt);
|
||||
assert.match(source.slice(initAt, initialActivateAt), /if \(document\.documentElement\.dataset\.aksrtUserCenterNavigationInitialized === 'true'\) return;/);
|
||||
assert.match(source.slice(initAt, initialActivateAt), /document\.documentElement\.dataset\.aksrtUserCenterNavigationInitialized = 'true';/);
|
||||
assert.doesNotMatch(source, /name === 'vip' && !forceLoad\) forceLoad = true/);
|
||||
});
|
||||
|
||||
test('homepage sort refreshes one DOM panel without URL state', () => {
|
||||
const source = read('assets/js/homepage-fixed.js')
|
||||
const homepage = read('inc/helpers/aksrt-homepage.php')
|
||||
const controller = read('src/Admin/GlobalController.php')
|
||||
assert.match(source, /event\.preventDefault\(\)/)
|
||||
assert.match(source, /requestHomepagePanel\(activePanel, \{/)
|
||||
assert.doesNotMatch(source, /home_sort|replaceState|location\.search|data-sort-ajax|homepageSortAjax/)
|
||||
assert.doesNotMatch(homepage, /home_sort|data-sort-ajax|add_query_arg\(['"]home_sort['"]|homepage_sort_ajax_enabled/)
|
||||
assert.doesNotMatch(controller, /'page_url'\s*=>|'source'\s*=>/)
|
||||
})
|
||||
test('HTML fragment injection announces post_ajax before auto_fun', () => {
|
||||
for (const file of ['assets/js/core/pagination.js', 'assets/js/author.js', 'assets/js/credits.js', 'assets/js/routes/user-center.js']) {
|
||||
const source = read(file);
|
||||
|
||||
Reference in New Issue
Block a user