дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 01:31:41 +02:00
A chevron in each cell toolbar folds the cell to one line (its first non-blank line, or a Markdown heading's text) with its output count; clicking the line unfolds it. Code cells with outputs get Hide Output / Show Output, which folds only the outputs, and the notebook toolbar gets Collapse All Cells / Expand All Cells. Fold state is view state on NotebookSession; the .ipynb file is not modified. The singular output counts use their own catalog keys so they don't collide with the run output pane's "{name} output".
Co-authored-by: Delaruno20 <[email protected]>
25 рядки
835 B
TypeScript
25 рядки
835 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { collapsedSummary } from "./NotebookEditor";
|
|
|
|
describe("a folded notebook cell", () => {
|
|
it("shows a code cell's first non-blank line and its output count", () => {
|
|
expect(collapsedSummary({ cellType: "code", source: "\n import pandas as pd\nx = 1", outputs: [{}, {}] })).toEqual(
|
|
{
|
|
text: "import pandas as pd",
|
|
outputs: 2,
|
|
},
|
|
);
|
|
});
|
|
|
|
it("shows a Markdown heading without its marks, and no outputs", () => {
|
|
expect(collapsedSummary({ cellType: "markdown", source: "## Results\nbody", outputs: [] })).toEqual({
|
|
text: "Results",
|
|
outputs: 0,
|
|
});
|
|
});
|
|
|
|
it("is empty for a blank cell", () => {
|
|
expect(collapsedSummary({ cellType: "code", source: " \n", outputs: [] })).toEqual({ text: "", outputs: 0 });
|
|
});
|
|
});
|