File tree Expand file tree Collapse file tree 2 files changed +44
-4
lines changed Expand file tree Collapse file tree 2 files changed +44
-4
lines changed Original file line number Diff line number Diff line change 29
29
<ol>
30
30
<li>List 2 item 1</li>
31
31
<li>List 2 item 2</li>
32
- <ol>
33
- <li>sub list 1</li>
34
- <li>sub list 2</li>
35
- </ol>
32
+ <li>
33
+ <ol>
34
+ <li>sub list 1</li>
35
+ <li>sub list 2</li>
36
+ </ol>
37
+ </li>
38
+
36
39
<li>List 2 item 3</li>
37
40
<ol>
38
41
<li>sub list 1, restarts with a</li>
Original file line number Diff line number Diff line change @@ -272,6 +272,43 @@ public function tesOrderedListNumbering()
272
272
$ this ->assertNotEquals ($ firstListnumId , $ secondListnumId );
273
273
}
274
274
275
+ /**
276
+ * Tests parsing of nested ul/li
277
+ */
278
+ public function testOrderedNestedListNumbering ()
279
+ {
280
+ $ phpWord = new \PhpOffice \PhpWord \PhpWord ();
281
+ $ section = $ phpWord ->addSection ();
282
+ $ html = '<ol>
283
+ <li>List 1 item 1</li>
284
+ <li>List 1 item 2</li>
285
+ </ol>
286
+ <p>Some Text</p>
287
+ <ol>
288
+ <li>List 2 item 1</li>
289
+ <li>
290
+ <ol>
291
+ <li>sub list 1</li>
292
+ <li>sub list 2</li>
293
+ </ol>
294
+ </li>
295
+ </ol> ' ;
296
+ Html::addHtml ($ section , $ html , false , false );
297
+
298
+ $ doc = TestHelperDOCX::getDocument ($ phpWord , 'Word2007 ' );
299
+ echo $ doc ->printXml ();
300
+ $ this ->assertTrue ($ doc ->elementExists ('/w:document/w:body/w:p/w:pPr/w:numPr/w:numId ' ));
301
+ $ this ->assertTrue ($ doc ->elementExists ('/w:document/w:body/w:p/w:r/w:t ' ));
302
+
303
+ $ this ->assertEquals ('List 1 item 1 ' , $ doc ->getElement ('/w:document/w:body/w:p[1]/w:r/w:t ' )->nodeValue );
304
+ $ this ->assertEquals ('List 2 item 1 ' , $ doc ->getElement ('/w:document/w:body/w:p[4]/w:r/w:t ' )->nodeValue );
305
+
306
+ $ firstListnumId = $ doc ->getElementAttribute ('/w:document/w:body/w:p[1]/w:pPr/w:numPr/w:numId ' , 'w:val ' );
307
+ $ secondListnumId = $ doc ->getElementAttribute ('/w:document/w:body/w:p[4]/w:pPr/w:numPr/w:numId ' , 'w:val ' );
308
+
309
+ $ this ->assertNotEquals ($ firstListnumId , $ secondListnumId );
310
+ }
311
+
275
312
/**
276
313
* Tests parsing of ul/li
277
314
*/
You can’t perform that action at this time.
0 commit comments