@@ -225,35 +225,6 @@ test("#parse handles multiple headers in list item", assert => {
225
225
} ) ;
226
226
227
227
// see https://github.com/bustle/mobiledoc-kit/issues/656
228
- //
229
- // this is a minimal example of markup that was causing errors when copy/pasting
230
- // from Medium. The original markup stucture that was pasted looked something like this:
231
- //
232
- // <section>
233
- // <div>
234
- // <div>
235
- // <h4>title</h4>
236
- // <ul><li>one - one</li></ul>
237
- // <figure><img /></figure>
238
- // <ul><li>two - one</li></ul>
239
- // </div>
240
- // </div>
241
- // </section>
242
- // <section>
243
- // <div><hr /></div>
244
- // <div><div><br /></div></div>
245
- // </section>
246
- //
247
- // NOTE: because DOMParser passes each top-level element to SectionParser rather
248
- // than passing the leaf-most section with content, the SectionParser needs to
249
- // deal with nested wrapper elements (section->div->div->[h4,ul,figure,ul])
250
- //
251
- // the error being thrown was
252
- // ---
253
- // Uncaught TypeError: Cannot read property 'append' of undefined
254
- // at SectionParser._createMarker
255
- // ---
256
- // the line in question was `state.section.markers.append(marker);`
257
228
test ( '#parse handles list following node handled by parserPlugin' , ( assert ) => {
258
229
let container = buildDOM ( `
259
230
<div><img src="https://placehold.it/100x100"><ul><li>LI One</li></ul></div>
@@ -281,6 +252,19 @@ test('#parse handles list following node handled by parserPlugin', (assert) => {
281
252
282
253
let listSection = sections [ 1 ] ;
283
254
assert . equal ( listSection . type , 'list-section' ) ;
255
+ assert . equal ( listSection . items . length , 1 , '1 list item' ) ;
256
+ } ) ;
257
+
258
+ test ( '#parse avoids empty paragraph around wrapped list' , ( assert ) => {
259
+ let container = buildDOM ( `
260
+ <div><ul><li>One</li></ul></div>
261
+ ` ) ;
262
+
263
+ let element = container . firstChild ;
264
+ parser = new SectionParser ( builder ) ;
265
+ let sections = parser . parse ( element ) ;
266
+
267
+ assert . equal ( sections . length , 1 , 'single list section' ) ;
284
268
} ) ;
285
269
286
270
test ( '#parse skips STYLE nodes' , ( assert ) => {
0 commit comments