mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-13 10:49:41 +02:00
docs(tiles): a reload brings the grid back only when it was open
The wiki, decision 11 in the tile-grid plan, its Persistence section, the
layout-memory test header and two tile-grid.js comments said the Tiles
button and a page reload bring the grid back however it was closed. Only
the Tiles button does: a grid closed before the reload stays stored as
open: false, the page shows the single view, and the toggle puts the grid
back. The behaviour was right; the wording now says that.
A test pins it through the real close path: arrange the grid, close it with
the toggle, start a fresh page, and the restore leaves the single view
while the toggle still brings back the cells, count, divider sizes, focus
and zoom. ('a stored closed grid leaves the single view' in
tile-grid-restore.test.ts covers the same from a raw stored value through
handleInit.)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,13 +7,14 @@
|
||||
* - Saved on every change (`codeman:tile-grid` in localStorage, never the
|
||||
* server): which session sits in which cell, holes included, the tile count,
|
||||
* the divider sizes, the focused tile and a zoom the user chose.
|
||||
* - The Tiles toggle and a page reload bring back exactly that, however the
|
||||
* grid was closed: the toggle, a tab that is not tiled, a followed link
|
||||
* (`leaveTiles`, or `#session=` on load), Home, the window narrowing past the
|
||||
* desktop gate, the last tile removed, "Open group as tiles", closing a
|
||||
* session, killing them all. It is never filled to the remembered count and
|
||||
* never trimmed to the window (a too-small window shows the focused tile
|
||||
* until it fits, the arrangement kept).
|
||||
* - The Tiles toggle brings back exactly that, however the grid was closed:
|
||||
* the toggle, a tab that is not tiled, a followed link (`leaveTiles`, or
|
||||
* `#session=` on load), Home, the window narrowing past the desktop gate,
|
||||
* the last tile removed, "Open group as tiles", closing a session, killing
|
||||
* them all. A page reload brings it back only when the grid was open (a
|
||||
* closed one stays remembered for the toggle). It is never filled to the
|
||||
* remembered count and never trimmed to the window (a too-small window
|
||||
* shows the focused tile until it fits, the arrangement kept).
|
||||
* - A session that no longer exists frees its cell, and the ranking fills it
|
||||
* (the hole a user left stays a hole); with none of the stored sessions left
|
||||
* the grid opens from the ranking, as with nothing stored.
|
||||
@@ -255,7 +256,7 @@ describe('saved on every change', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('the Tiles toggle and a reload bring back exactly what was arranged', () => {
|
||||
describe('the Tiles toggle (and a reload while it is open) brings back exactly what was arranged', () => {
|
||||
it('off and on: the cells and the hole, the count, the divider sizes, the focus and the zoom', async () => {
|
||||
const app = layoutApp();
|
||||
await arrange(app);
|
||||
@@ -291,6 +292,23 @@ describe('the Tiles toggle and a reload bring back exactly what was arranged', (
|
||||
expect(layoutOf(next)).toEqual(before);
|
||||
});
|
||||
|
||||
it('a reload after the grid was closed: the single view, and the Tiles toggle brings it back exactly', async () => {
|
||||
const app = layoutApp();
|
||||
await arrange(app);
|
||||
const before = layoutOf(app);
|
||||
app.toggleTileGrid();
|
||||
section.children = [];
|
||||
FakeTile.all = [];
|
||||
const next = layoutApp();
|
||||
// The reload leaves it closed (handleInit then selects the single view)...
|
||||
expect(next._restoreTileGrid()).toBe(false);
|
||||
expect(next._tilesOwnTerminal()).toBe(false);
|
||||
expect(stored()).toMatchObject({ open: false, ids: ARRANGED_CELLS });
|
||||
// ...and remembered: the toggle puts it back as it was.
|
||||
next.toggleTileGrid();
|
||||
expect(layoutOf(next)).toEqual(before);
|
||||
});
|
||||
|
||||
it('never trimmed to a smaller window: the focused tile shows alone, and the arrangement is kept for a wider one', async () => {
|
||||
const app = layoutApp();
|
||||
app.openTileGrid(SIX, { focusedId: 's-c' });
|
||||
|
||||
Reference in New Issue
Block a user