Files
OpenResearch/ui/tests/htmlPreviewSizing.test.mjs
T
Daniel Kim 2149a29467 OR-397: Improve onboarding demos, charts, and image previews (#593)
* Make the nanochat demo quick and render interactive experiment figures

* Fix chart ranges and bound inline preview sizing

* Refine demo results, chart interactions, and image carousels

* Split experiment evidence skills and address chart review feedback

* Preserve zoom selections and format small axis ticks

* Choose axis label precision from tick spacing

* Keep single training-step ticks exact after zoom

* Retain visible confidence bands and skip empty keyboard slices

* Load results guidance before experiment summaries and avoid duplicate comparisons
2026-10-09 01:20:57 -07:00

18 lines
655 B
JavaScript

import assert from "node:assert/strict";
import test from "node:test";
import { inlineHtmlHeight } from "../src/htmlPreviewSizing.ts";
test("inline figures keep natural heights and reject malformed messages", () => {
assert.equal(inlineHtmlHeight(418.2), 419);
for (const value of [null, "418", 0, -1, NaN, Infinity]) {
assert.equal(inlineHtmlHeight(value), null);
}
});
test("viewport height plus body margins converges instead of growing indefinitely", () => {
let height = 360;
for (let i = 0; i < 100; i++) height = inlineHtmlHeight(height + 16);
assert.equal(inlineHtmlHeight(height + 16), height);
assert.ok(height <= 1200);
});