From f25708de9a581319c7f7bb99e846c206ca01b849 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Fri, 26 Jan 2024 15:11:18 +0000 Subject: [PATCH] fix some inline tests? --- lib/model/content.dart | 16 +++++++++++++--- test/model/content_test.dart | 33 +++++++++++++-------------------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/lib/model/content.dart b/lib/model/content.dart index 36e020b57c..da0e2e3d4b 100644 --- a/lib/model/content.dart +++ b/lib/model/content.dart @@ -1016,9 +1016,19 @@ class _ZulipContentParser { if (node is dom.Text && (node.text == '\n')) continue; if (_isPossibleInlineNode(node)) { - // TODO: It seems impossible to trigger this using real markup. - // Images are always the final items of a list item. - if (imageNodes.isNotEmpty) consumeImages(); + if (imageNodes.isNotEmpty) { + consumeImages(); + // In a context where paragraphs are implicit it + // should be impossible to have more paragraph + // content after image previews. + result.add(ParagraphNode( + wasImplicit: true, + links: null, + nodes: [UnimplementedInlineContentNode(htmlNode: node)] + )); + // But what to do with the rest of the content? + continue; + } currentParagraph.add(node); continue; } diff --git a/test/model/content_test.dart b/test/model/content_test.dart index b09b1f0cf3..19f002614c 100644 --- a/test/model/content_test.dart +++ b/test/model/content_test.dart @@ -531,7 +531,8 @@ void main() { ]), ]); - testParse('image as immediate child in list item', + // TODO: maybe delete this + testParse('image as immediate child in implicit paragraph', // "* https://chat.zulip.org/user_avatars/2/realm/icon.png" '