Files
wekan/tests/listCollapseRefresh.test.cjs
T
Lauri Ojansivu 773a1c2ddf Restore saved list collapse state after page reload
Read stored per-user list state reactively instead of caching an early expanded fallback in Session. Cover profile hydration and a Chromium reload with the persisted swimlane-scoped value.

Thanks to Nich01asFox and xet7 !

Fixes #6712,
2026-09-22 15:13:00 +03:00

22 lines
956 B
JavaScript

'use strict';
const assert = require('node:assert/strict');
const fs = require('node:fs');
const { test } = require('node:test');
const utils = fs.readFileSync('client/lib/utils.js', 'utf8');
const getter = utils.slice(utils.indexOf(' getListCollapseState('), utils.indexOf(' setListCollapseState('));
test('a saved collapsed value can replace the default after profile hydration', () => {
assert.match(getter, /Session\.get\(key\)/);
assert.match(getter, /getCollapsedListFromStorage\(list\.boardId, storageId\)/);
assert.doesNotMatch(getter, /Session\.setDefault\(key,/);
assert.match(getter, /return stored;/);
});
test('an explicit local toggle still wins while the server persists it', () => {
const setter = utils.slice(utils.indexOf(' setListCollapseState('), utils.indexOf(' getCardCollapseState('));
assert.match(setter, /Session\.set\(key, !!collapsed\)/);
assert.match(setter, /Meteor\.call\('setListCollapsedState'/);
});