feat(ask): add preview pane and wrapped content
This commit is contained in:
+1
-1
@@ -54,12 +54,12 @@ test("normalize defaults via initial state", () => {
|
||||
|
||||
assert.equal(state.questions[0].label, "Q1");
|
||||
assert.equal(state.questions[0].type, "single");
|
||||
assert.equal(state.questions[0].allowOther, true);
|
||||
assert.equal(state.questions[0].required, true);
|
||||
assert.equal(
|
||||
getRenderableOptions(state.questions[0]).at(-1)?.label,
|
||||
"Type your own",
|
||||
);
|
||||
assert.equal(getRenderableOptions(state.questions[0]).at(-1)?.isOther, true);
|
||||
});
|
||||
|
||||
test("preview questions keep their type and option previews", () => {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { wrapText } from "../src/text.ts";
|
||||
|
||||
test("wrapText wraps prose", () => {
|
||||
assert.deepEqual(wrapText("hello world from pi", 8), [
|
||||
"hello",
|
||||
"world",
|
||||
"from pi",
|
||||
]);
|
||||
});
|
||||
|
||||
test("wrapText preserves blank lines and indentation", () => {
|
||||
assert.deepEqual(wrapText("Title\n\n indented text", 12), [
|
||||
"Title",
|
||||
"",
|
||||
" indented",
|
||||
" text",
|
||||
]);
|
||||
});
|
||||
|
||||
test("wrapText breaks long words", () => {
|
||||
assert.deepEqual(wrapText("supercalifragilistic", 5), [
|
||||
"super",
|
||||
"calif",
|
||||
"ragil",
|
||||
"istic",
|
||||
]);
|
||||
});
|
||||
Reference in New Issue
Block a user