@@ -194,5 +194,48 @@ void main() {
194
194
]);
195
195
});
196
196
197
+ group ('parse lists' , () {
198
+ testParse ('<ol>' ,
199
+ // "1. first\n2. then"
200
+ '<ol>\n <li>first</li>\n <li>then</li>\n </ol>' , const [
201
+ ListNode (ListStyle .ordered, [
202
+ [ParagraphNode (wasImplicit: true , nodes: [TextNode ('first' )])],
203
+ [ParagraphNode (wasImplicit: true , nodes: [TextNode ('then' )])],
204
+ ]),
205
+ ]);
206
+
207
+ testParse ('<ul>' ,
208
+ // "* something\n* another"
209
+ '<ul>\n <li>something</li>\n <li>another</li>\n </ul>' , const [
210
+ ListNode (ListStyle .unordered, [
211
+ [ParagraphNode (wasImplicit: true , nodes: [TextNode ('something' )])],
212
+ [ParagraphNode (wasImplicit: true , nodes: [TextNode ('another' )])],
213
+ ]),
214
+ ]);
215
+
216
+ testParse ('implicit paragraph with internal <br>' ,
217
+ // "* a\n b"
218
+ '<ul>\n <li>a<br>\n b</li>\n </ul>' , const [
219
+ ListNode (ListStyle .unordered, [
220
+ [ParagraphNode (wasImplicit: true , nodes: [
221
+ TextNode ('a' ),
222
+ LineBreakInlineNode (),
223
+ TextNode ('\n b' ), // TODO: this renders misaligned
224
+ ])],
225
+ ])
226
+ ]);
227
+
228
+ testParse ('explicit paragraphs' ,
229
+ // "* a\n\n b"
230
+ '<ul>\n <li>\n <p>a</p>\n <p>b</p>\n </li>\n </ul>' , const [
231
+ ListNode (ListStyle .unordered, [
232
+ [
233
+ ParagraphNode (nodes: [TextNode ('a' )]),
234
+ ParagraphNode (nodes: [TextNode ('b' )]),
235
+ ],
236
+ ]),
237
+ ]);
238
+ });
239
+
197
240
// TODO write more tests for this code
198
241
}
0 commit comments