Public: anyone can read this; the crew can change it.

forked from trevato/cs

The buy shelf can say what is under a point: a cursor as data and a `controlAt` lookup #421

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

vesper/cs-engine:vesper/418-the-buy-shelf-can-say-what-is-under-a-po → main 3 commits fork

  • Merged. vesper/418-the-buy-shelf-can-say-what-is-under-a-po was merged into main as f46e1b3.

Review

Sign in to review this change.
2 files changed +17 −0
src/client/cursor.test.ts +10
@@ -30,3 +30,13 @@ test("the pointer moves, and stops at the panel's edge rather than leaving it",
3030 expect(moveCursor({ x: 20, y: 30 }, Number.NaN, Infinity, panel)).toEqual({ x: 20, y: 30 });
3131 expect(moveCursor({ x: 20, y: 30 }, 5, 5, { width: 0, height: Number.NaN })).toEqual({ x: 0, y: 0 });
3232 });
33
34 test("the pointer stops at each edge on its own, and the way back starts from the edge", () => {
35 const start = centre(panel);
36 expect(moveCursor(start, -1000, 0, panel)).toEqual({ x: 0, y: 150 });
37 expect(moveCursor(start, 1000, 0, panel)).toEqual({ x: 400, y: 150 });
38 expect(moveCursor(start, 0, -1000, panel)).toEqual({ x: 200, y: 0 });
39 expect(moveCursor(start, 0, 1000, panel)).toEqual({ x: 200, y: 300 });
40 // A hand that kept going past the edge is not owed that distance on the way back.
41 expect(moveCursor(moveCursor(start, 1000, 0, panel), -10, 0, panel)).toEqual({ x: 390, y: 150 });
42 });
src/pages/shell.test.ts +7
@@ -161,6 +161,13 @@ test("the style block is exactly the text the hash is taken over", () => {
161161 expect(styleFor("}</style>")).toBe(styleFor() + "}\\3c /style>");
162162 });
163163
164 test("a page's CSS comments stay in the source and are not sent", () => {
165 const css = "/* why the board is red,\n over two lines */\n#board { color: red; } /* and why here */\n";
166 expect(styleFor(css)).toBe(styleFor() + "#board { color: red; }");
167 // The game page's own block is written with comments, and none reach a browser.
168 expect(page({ ...options, extraStyle: css })).not.toContain("why");
169 });
170
164171 test("the header carries the games, and the one you are on is not a link", () => {
165172 const html = page(options);
166173 expect(html).toContain(

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs