testing.FakeSession.resize ​Contract 2.0.0 · package sha256
a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e· generated fromtesting.d.tsbyservices/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()
resize?(width: number, height: number): void;
Resizes the element to width × height CSS px, as the page's layout would: the viewport
createFakeSession took changes at once (camera.state.aspect, camera.project, picks,
info()), 'resize' fires at the next drawn frame with the new size, and the anchors report
again after it ('anchors:moved'). The same size again does nothing.
Errors: a width or height that is not a positive finite number throws HoloInputError.
Experimental, so optional in this declaration: a test calls fake.resize?.(w, h).
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.resize.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 layout that switches to its narrow panel under 600 CSS px.
const fake = createFakeSession({ viewport: { width: 800, height: 600 } });
export const layout = { narrow: false };
fake.on('resize', ({ width }) => void (layout.narrow = width < 600));
fake.resize?.(390, 700);
fake.tick(16); // 'resize' { width: 390, height: 700 }
if (!layout.narrow) throw new Error('the narrow layout did not switch on');
| Rule | Result |
|---|---|
| 1. Neutral name | pass: resize 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) |