- New nodes: Image Resize plus the Utility group (Text, Integer, Float, Show Text, Math Expression, Select Every Nth, Split Batch, Merge Batches, Free Memory) - the dependency-free gaps that let shared workflows drop heavy packs. - Replace with AusBoss nodes (prototype): preview-then-confirm graph rewrite swapping known third-party nodes for pack equivalents, with a tested translation map, per-node opt-out, and refuse-with-reason for nodes the pack cannot stand in for. - Load Video: single-frame FRAME picker, an honest "what will load" label from the probed source rate, drop-a-video-to-restore. Save Video: format-aware widgets and a file_path output. Stitch Inpaint gained a blend_mask output, Select Frame negative from-the-end indexing, Image Size a batch count - all appended, saved workflows load unchanged. - LoRA Loader: drag-to-reorder rows, hover thumbnails on rows, file size and date in the info card. - Appearance: flagship scheme deepened to slate-teal; the retired bright-teal pair upgrades automatically via LEGACY_SCHEME_PAIRS. Optional queue-completion chime, off by default. - Image Resize invariant: pixels are only invented on an explicit width+height pad request - scale-derived modes resolve divisible_by snaps with a sub-half-step resize, never bars. - Docs refreshed for six stale pages, stale text and metadata fixed across the pack, the panel-height rule codified in AGENTS.md and the brand skill, and ausboss_node_tour.json added - a model-free example exercising 17 node types in one graph. Validated: scripts/validate_nodes.py (24 files), 300 JS tests, all Python suites under the ComfyUI embedded interpreter.
63 lines
2.3 KiB
JavaScript
63 lines
2.3 KiB
JavaScript
// The Show Text panel's decision logic: how an executed message becomes the
|
|
// one string the panel renders, and where the display (not the wire) cuts a
|
|
// runaway string off.
|
|
|
|
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { DISPLAY_LIMIT, displayText, textFromExecuted } from "../js/shared/show_text.mjs";
|
|
|
|
test("a plain ui payload comes back as its string", () => {
|
|
assert.equal(textFromExecuted({ text: ["hello"] }), "hello");
|
|
});
|
|
|
|
test("multiple entries join on newlines", () => {
|
|
assert.equal(textFromExecuted({ text: ["a", "b"] }), "a\nb");
|
|
});
|
|
|
|
test("nested arrays flatten in order", () => {
|
|
assert.equal(textFromExecuted({ text: [["a", ["b"]], "c"] }), "a\nb\nc");
|
|
});
|
|
|
|
test("non-string entries are stringified rather than dropped", () => {
|
|
assert.equal(textFromExecuted({ text: [7] }), "7");
|
|
});
|
|
|
|
test("an empty string is a real result, not a missing one", () => {
|
|
// "" means "the run delivered empty text" and the panel says so; null
|
|
// means "nothing arrived" and the panel keeps its placeholder.
|
|
assert.equal(textFromExecuted({ text: [""] }), "");
|
|
});
|
|
|
|
test("nothing arriving is null, so the placeholder survives", () => {
|
|
assert.equal(textFromExecuted(undefined), null);
|
|
assert.equal(textFromExecuted({}), null);
|
|
assert.equal(textFromExecuted({ text: [] }), null);
|
|
assert.equal(textFromExecuted({ text: null }), null);
|
|
assert.equal(textFromExecuted({ images: [{}] }), null);
|
|
});
|
|
|
|
test("short text displays whole", () => {
|
|
assert.deepEqual(displayText("short"), { text: "short", truncated: false });
|
|
});
|
|
|
|
test("text at the limit is not truncated", () => {
|
|
const exact = "x".repeat(DISPLAY_LIMIT);
|
|
assert.deepEqual(displayText(exact), { text: exact, truncated: false });
|
|
});
|
|
|
|
test("text over the limit truncates at the limit", () => {
|
|
const long = "x".repeat(DISPLAY_LIMIT + 5);
|
|
const shown = displayText(long);
|
|
assert.equal(shown.truncated, true);
|
|
assert.equal(shown.text.length, DISPLAY_LIMIT);
|
|
});
|
|
|
|
test("a custom limit is honored", () => {
|
|
assert.deepEqual(displayText("abcdef", 3), { text: "abc", truncated: true });
|
|
});
|
|
|
|
test("non-strings display as nothing", () => {
|
|
assert.deepEqual(displayText(undefined), { text: "", truncated: false });
|
|
assert.deepEqual(displayText(42), { text: "", truncated: false });
|
|
});
|