test: update fenced markdown expectations

This commit is contained in:
TomBanksAU
2026-06-22 06:55:09 +00:00
parent d5384860d0
commit 0cee92c9f6
4 changed files with 10 additions and 7 deletions
+1 -1
View File
@@ -126,7 +126,7 @@ class TestUserFencedBlocks:
def test_four_backtick_outer_fence_preserves_inner_triple_fence(self):
"""User-message code fences should follow CommonMark fence-length matching too."""
out = _run_user_render("````md\n```inner\nfoo\n```\n````")
assert out.count("<pre>") == 1
assert out.count("<pre class=\"md-source-block\">") == 1
assert out.count("</pre>") == 1
assert '<div class="pre-header">md</div>' in out
assert "```inner" in out
+3 -1
View File
@@ -41,7 +41,9 @@ def test_csv_fence_fallback_for_insufficient_rows():
src = f.read()
fence_section = src[src.find("lang==='csv'"):src.find("lang==='csv'") + 800]
assert 'rows.length>=2' in fence_section, "Should check for at least 2 rows"
assert '<pre><code' in fence_section, "Fallback should render as <pre><code>"
assert '<pre${preClass}><code${langAttr}>' in fence_section, (
"Fallback should render via the shared preClass-aware code-block template"
)
def test_csv_media_file_handler():
+4 -3
View File
@@ -17,9 +17,10 @@ def test_fenced_code_blocks_add_prism_language_class():
def test_fenced_code_blocks_keep_existing_pre_header_layout():
js = _read_ui_js()
# The fenced code rendering was moved into the stash callback (#1154 fix).
# The template string now uses `lang` instead of `normalizedLang`.
assert '${h}<pre><code${langAttr}>${esc(code.replace(/\\n$/,' in js, (
"The syntax-highlight fix should preserve the existing fenced code block layout"
# The template string now uses `lang` instead of `normalizedLang`, and
# markdown-source fences may add a dedicated md-source-block class.
assert '${h}<pre${preClass}><code${langAttr}>${esc(code.replace(/\\n$/,' in js, (
"The syntax-highlight fix should preserve the shared fenced code block layout"
)
assert '<div class="code-block">' not in js, (
"This fix should not introduce a new wrapper around fenced code blocks"
+2 -2
View File
@@ -397,7 +397,7 @@ class TestFencedCodeFenceLength:
"That is much more correct than pretending"
)
out = _render(driver_path, src)
assert out.count("<pre>") == 1
assert out.count("<pre class=\"md-source-block\">") == 1
assert out.count("</pre>") == 1
assert '<div class="pre-header">md</div>' in out
assert "```novelcrafter" in out
@@ -408,7 +408,7 @@ class TestFencedCodeFenceLength:
def test_four_backtick_outer_fence_preserves_inner_triple_fence(self, driver_path):
out = _render(driver_path, "````md\n```inner\nfoo\n```\n````\n")
assert out.count("<pre>") == 1
assert out.count("<pre class=\"md-source-block\">") == 1
assert out.count("</pre>") == 1
assert '<div class="pre-header">md</div>' in out
assert "```inner" in out