Skip to content

Commit 8f21330

Browse files
dsolistorresclaude
andcommitted
test: normalize whitespace before asserting mark wrappings
The inline MACRO registered in @before pads tags with newlines and indent, so contains-checks for contiguous wrappings like <sup>sup</sup> never match even when the macro is correct. Strip whitespace before asserting so the test still verifies the wrapping order and nesting. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 3720a9b commit 8f21330

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

dotcms-integration/src/test/java/com/dotcms/rendering/velocity/viewtools/content/StoryBlockMapTest.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,16 @@ public void test_subscript_and_superscript_marks_render_to_html() throws JSONExc
288288

289289
final StoryBlockMap storyBlockMap = new StoryBlockMap(JSON_SUB_SUP);
290290
final String html = storyBlockMap.toHtml();
291-
292-
Assert.assertTrue(html + ": missing <sup>sup</sup>", html.contains("<sup>sup</sup>"));
293-
Assert.assertTrue(html + ": missing <sub>sub</sub>", html.contains("<sub>sub</sub>"));
291+
// The inline MACRO registered in @Before pads tags with newlines/indent, so
292+
// strip whitespace before asserting on contiguous mark wrappings.
293+
final String normalized = html.replaceAll("\\s+", "");
294+
295+
Assert.assertTrue(html + ": missing <sup>sup</sup>",
296+
normalized.contains("<sup>sup</sup>"));
297+
Assert.assertTrue(html + ": missing <sub>sub</sub>",
298+
normalized.contains("<sub>sub</sub>"));
294299
Assert.assertTrue(html + ": missing <strong><sup>bold-sup</sup></strong>",
295-
html.contains("<strong><sup>bold-sup</sup></strong>"));
300+
normalized.contains("<strong><sup>bold-sup</sup></strong>"));
296301
}
297302

298303
/**

0 commit comments

Comments
 (0)