changes
This commit is contained in:
@@ -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"]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user