This commit is contained in:
alex wiesner
2026-04-09 11:31:06 +01:00
parent 8fec8e28f4
commit 18245c778e
155 changed files with 16206 additions and 2980 deletions

View File

@@ -11,6 +11,7 @@ import {
nextTabAfterAnswer,
normalizeQuestions,
summarizeAnswers,
wrapPrefixedText,
} from "./question-core.mjs";
test("normalizeQuestions adds default labels and appends the Something else option", () => {
@@ -157,3 +158,23 @@ test("nextTabAfterAnswer advances through questions and then to the submit tab",
assert.equal(nextTabAfterAnswer(1, 3), 2);
assert.equal(nextTabAfterAnswer(2, 3), 3);
});
test("wrapPrefixedText wraps long prompts and keeps the prefix on continuation lines", () => {
assert.deepEqual(wrapPrefixedText("Pick the best rollout strategy for this change", 18, " "), [
" Pick the best",
" rollout strategy",
" for this change",
]);
});
test("wrapPrefixedText supports a different continuation prefix for wrapped option labels", () => {
assert.deepEqual(wrapPrefixedText("Very long option label", 16, "> 1. ", " "), [
"> 1. Very long",
" option",
" label",
]);
});
test("wrapPrefixedText breaks oversized words when there is no whitespace boundary", () => {
assert.deepEqual(wrapPrefixedText("supercalifragilistic", 8), ["supercal", "ifragili", "stic"]);
});