mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 08:59:40 +02:00
test(tiles): the grid harness finds a tile's element, and serves the pure helpers
Five tile-grid tests defined the same `tileEl(id)` lookup and three more inlined it; the harness (test/mocks/tile-grid-vm.ts) now exports it and they import it. tile-grid-open-set built a second vm context just to read constants.js, although the harness it already imports has loaded the same file: it reads windowStub.CodemanTileGrid instead. No assertion changed. Mutation-checked: tiles without their data-session-id fail 34 tests across the seven files, and a broken tileGridOpenSet fails the open-set cases. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { FakeEl, FakeTile, makeGridApp, resetGridHarness, section, type GridApp } from './mocks/tile-grid-vm.js';
|
||||
import { FakeEl, FakeTile, makeGridApp, resetGridHarness, type GridApp, tileEl } from './mocks/tile-grid-vm.js';
|
||||
|
||||
const IDS = ['s-a', 's-b', 's-c'];
|
||||
|
||||
@@ -38,7 +38,6 @@ function openGrid(): GridApp {
|
||||
return app;
|
||||
}
|
||||
|
||||
const tileEl = (id: string) => section.children.find((el) => el.dataset.sessionId === id) as FakeEl;
|
||||
const headerOf = (id: string) => tileEl(id).children[0];
|
||||
const buttonOf = (id: string, cls: string) =>
|
||||
headerOf(id).children[2].children.find((b) => b.className.includes(cls)) as FakeEl;
|
||||
@@ -99,7 +98,7 @@ describe('the header', () => {
|
||||
describe('header buttons', () => {
|
||||
it('are ⋯ ⤢ × and nothing else: no + (owner decision 9)', () => {
|
||||
const app = openGrid();
|
||||
const tile = section.children.find((el) => el.dataset.sessionId === 's-a') as FakeEl;
|
||||
const tile = tileEl('s-a');
|
||||
const actions = tile.children[0].children.find((c) => c.className === 'tile-actions') as FakeEl;
|
||||
expect(actions.children.map((b) => b.className)).toEqual([
|
||||
'tile-btn tile-menu',
|
||||
|
||||
Reference in New Issue
Block a user