Il viale alberato della Provinciale e la Carza verso La Luna; la mappa si cerca scrivendo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ApqNBvNbNCwXqR2RLo8QJh
This commit is contained in:
+12
-1
@@ -237,7 +237,18 @@ try {
|
||||
assert.equal(await page.locator('#map-board button[data-scene="pieve"]').count(), 0, 'la Pieve non è ancora vista');
|
||||
assert.ok(await page.isVisible('#map-board button.here[data-scene="trebbio"]'));
|
||||
await page.screenshot({ path: `${OUT}/07b-mappa.png` });
|
||||
await page.click('#map-board button[data-scene="piazza"]');
|
||||
// La ricerca: scrivendo restano solo i posti giusti; una «p» nella casella non chiude la mappa; Invio ci va.
|
||||
await page.fill('#map-search', 'xyz');
|
||||
assert.ok(await page.isVisible('#map-none'), 'nessun posto: lo dice');
|
||||
await page.fill('#map-search', '');
|
||||
await page.click('#map-search');
|
||||
await page.keyboard.type('piaz');
|
||||
assert.ok(await page.isVisible('#map'), 'scrivere «p» nella ricerca non chiude la mappa');
|
||||
assert.ok(await page.isHidden('#map-none'));
|
||||
const shown = await page.locator('#map-board button:visible').evaluateAll(bs => bs.map(b => b.dataset.scene));
|
||||
assert.deepEqual(shown, ['piazza']);
|
||||
await page.screenshot({ path: `${OUT}/07c-mappa-ricerca.png` });
|
||||
await page.keyboard.press('Enter');
|
||||
assert.ok(await page.isHidden('#map'));
|
||||
assert.equal(await page.evaluate(() => game.state.scene), 'piazza');
|
||||
|
||||
|
||||
+12
-1
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
|
||||
import { backgroundOrder } from '../src/engine/render.js';
|
||||
import { story } from '../src/story/story.js';
|
||||
import { solution } from '../src/story/solution.js';
|
||||
import { Game, VERBS, checkSave, introText, shuffledCredits } from '../src/engine/game.js';
|
||||
import { Game, VERBS, checkSave, introText, shuffledCredits, matchPlace } from '../src/engine/game.js';
|
||||
import { inside } from '../src/engine/geometry.js';
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import { settle } from './helpers.mjs';
|
||||
@@ -101,6 +101,17 @@ test('i crediti: i nomi di ogni voce escono in ordine casuale, sempre tutti', ()
|
||||
assert.ok(orders.size > 3, `${idee}: l'ordine non cambia`);
|
||||
});
|
||||
|
||||
test('la ricerca della mappa: pezzi di parola, senza maiuscole, accenti e apostrofi', () => {
|
||||
assert.ok(matchPlace('Campomigliaio', 'camp'));
|
||||
assert.ok(matchPlace('Via de\' Medici', 'de medici'));
|
||||
assert.ok(matchPlace('Via de\' Medici', 'MEDICI via'), 'le parole in qualsiasi ordine');
|
||||
assert.ok(matchPlace('La Pieve di San Pietro', 'pieve '));
|
||||
assert.ok(matchPlace('Piazza', ''), 'casella vuota: tutti');
|
||||
assert.ok(!matchPlace('Piazza', 'pieve'));
|
||||
const names = Object.values(story.scenes).filter(s => s.map).map(s => s.name);
|
||||
assert.ok(names.filter(n => matchPlace(n, 'provinciale')).length >= 2, 'più posti sulla Provinciale');
|
||||
});
|
||||
|
||||
test('la soluzione si percorre tutta dall\'inizio alla fine', () => {
|
||||
const saves = [];
|
||||
const g = new Game(story, { onSave: s => saves.push(s) });
|
||||
|
||||
Reference in New Issue
Block a user