testing.FakeSession.hotspot ​

Contract 2.0.0 · package sha256 a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e · generated from testing.d.ts by services/onsite-scripter/scripts/build-contract-docs.mjs; edit the source, not this file.

Method of testing.FakeSession · labs, @experimental · since 2.0.0 · optional: reach it through has()

ts
hotspot?(id: string, action?: 'click' | 'hover' | 'leave'): boolean;

The shopper's pointer on a hotspot badge, by its HotspotBadge.id. 'click' fires 'hotspot:click' at once, as a press released on the badge's button does (no canvas 'click', no camera gesture). 'hover' moves the pointer onto the badge and 'leave' off it: each fires 'hotspot:hover' at once when what it reports changes (the badge under the pointer, else the badge with keyboard focus, else null). A hotspots.set draws its badges at the next drawn frame, so call this after a frame() or tick(16). Returns false and fires nothing for an id no badge has now, a badge the latest hotspots.set removed, a badge off-screen (behind the camera or outside the element, which the runtime hides from the pointer), or a 'leave' of a badge the pointer isn't on. The runtime also hides a badge a part occludes; the fake doesn't. Errors: an id that is no string or another action throws HoloInputError at the call. Experimental, so optional in this declaration: a test calls fake.hotspot?.(id).

Default: action 'click'

Example ​

Imports: values (has, validate, the Holo*Error classes, the pure helpers) from @holostep-configurators/runtime-client, types from @holostep-configurators/runtime-client/contract, /math and /testing names from those entries; boot from the runtime module the root's loadRuntimeAtFloor resolves to. A type your page defines is your app's: declare it there, never import it from the package.

Compiled under the contract's strict settings (examples/declaration/24-FakeSession.hotspot.ts):

ts
import { createFakeSession } from '@holostep-configurators/runtime-client/testing';
import type { Session } from '@holostep-configurators/runtime-client/contract';
declare const session: Session;
declare const signal: AbortSignal;
// A walk-through page opens a room's panel from its badge.
const fake = createFakeSession({});
export const opened: string[] = [];
fake.on('hotspot:click', ({ hotspot }) => void opened.push(hotspot.id));
fake.overlays.hotspots.set([{ id: 'kitchen', at: { x: 0, y: 1, z: 0 }, label: 'Kitchen' }]);
fake.frame();                                             // the badges draw
fake.hotspot?.('kitchen', 'hover');                       // 'hotspot:hover' { id: 'kitchen' }
fake.hotspot?.('kitchen');                                // 'hotspot:click'
if (opened[0] !== 'kitchen') throw new Error('the badge did not open its panel');

Generic-API test (spec 3.1) ​

Rule Result
1. Neutral name pass: hotspot names no product
2. A precedent not recorded: no ledger row (coverage.json) names this member or its owner
3. Two apps, or labs labs (@experimental at a stable path, reached through has() or supports()): it graduates when a second app uses it
4. The cheaper fix first not recorded per member (Appendix B decides it per need)