mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-06 02:21:43 +08:00
test(settings): cover code block preview wrapping
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -34,8 +34,9 @@ const CODE_BLOCK_PREVIEW_SNIPPET = `def fibonacci(n):
|
||||
return result
|
||||
|
||||
|
||||
# Print the first 10 numbers in the sequence
|
||||
print(f"fibonacci(10) = {fibonacci(10)}")
|
||||
# Build a deliberately long summary so the wrapping preference is easy to see
|
||||
summary = f"First twenty Fibonacci values rendered with the selected syntax theme, line-number setting, and wrapping preference: {', '.join(str(value) for value in fibonacci(20))}"
|
||||
print(summary)
|
||||
`;
|
||||
|
||||
const RichCodeBlockPreview = dynamic(
|
||||
|
||||
@@ -71,3 +71,15 @@ test("appearance settings page: exposes every registered code block theme option
|
||||
assert.ok(CODE_BLOCK_THEME_OPTIONS.length > 0);
|
||||
assert.match(source, /CODE_BLOCK_THEME_OPTIONS\.map/);
|
||||
});
|
||||
|
||||
test("appearance settings page: preview includes a line long enough to demonstrate wrapping", () => {
|
||||
const source = readAppearancePage();
|
||||
const previewSource =
|
||||
source.match(/const CODE_BLOCK_PREVIEW_SNIPPET = `([\s\S]*?)`;/)?.[1] ?? "";
|
||||
|
||||
assert.ok(previewSource, "The fixed Python preview snippet should exist");
|
||||
assert.ok(
|
||||
previewSource.split("\n").some((line) => line.length >= 120),
|
||||
"The preview needs a 120+ character line so Wrap long lines has a visible effect",
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user