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 31
31
<ol>
32
32
<li>List 2 item 1</li>
33
33
<li>List 2 item 2</li>
34
- <ol>
35
- <li>sub list 1</li>
36
- <li>sub list 2</li>
37
- </ol>
34
+ <li>
35
+ <ol>
36
+ <li>sub list 1</li>
37
+ <li>sub list 2</li>
38
+ </ol>
39
+ </li>
40
+
38
41
<li>List 2 item 3</li>
39
42
<ol>
40
43
<li>sub list 1, restarts with a</li>
Original file line number Diff line number Diff line change @@ -299,6 +299,43 @@ public function testOrderedListNumbering()
299
299
$ this ->assertNotEquals ($ firstListnumId , $ secondListnumId );
300
300
}
301
301
302
+ /**
303
+ * Tests parsing of nested ul/li
304
+ */
305
+ public function testOrderedNestedListNumbering ()
306
+ {
307
+ $ phpWord = new \PhpOffice \PhpWord \PhpWord ();
308
+ $ section = $ phpWord ->addSection ();
309
+ $ html = '<ol>
310
+ <li>List 1 item 1</li>
311
+ <li>List 1 item 2</li>
312
+ </ol>
313
+ <p>Some Text</p>
314
+ <ol>
315
+ <li>List 2 item 1</li>
316
+ <li>
317
+ <ol>
318
+ <li>sub list 1</li>
319
+ <li>sub list 2</li>
320
+ </ol>
321
+ </li>
322
+ </ol> ' ;
323
+ Html::addHtml ($ section , $ html , false , false );
324
+
325
+ $ doc = TestHelperDOCX::getDocument ($ phpWord , 'Word2007 ' );
326
+ echo $ doc ->printXml ();
327
+ $ this ->assertTrue ($ doc ->elementExists ('/w:document/w:body/w:p/w:pPr/w:numPr/w:numId ' ));
328
+ $ this ->assertTrue ($ doc ->elementExists ('/w:document/w:body/w:p/w:r/w:t ' ));
329
+
330
+ $ this ->assertEquals ('List 1 item 1 ' , $ doc ->getElement ('/w:document/w:body/w:p[1]/w:r/w:t ' )->nodeValue );
331
+ $ this ->assertEquals ('List 2 item 1 ' , $ doc ->getElement ('/w:document/w:body/w:p[4]/w:r/w:t ' )->nodeValue );
332
+
333
+ $ firstListnumId = $ doc ->getElementAttribute ('/w:document/w:body/w:p[1]/w:pPr/w:numPr/w:numId ' , 'w:val ' );
334
+ $ secondListnumId = $ doc ->getElementAttribute ('/w:document/w:body/w:p[4]/w:pPr/w:numPr/w:numId ' , 'w:val ' );
335
+
336
+ $ this ->assertNotEquals ($ firstListnumId , $ secondListnumId );
337
+ }
338
+
302
339
/**
303
340
* Tests parsing of ul/li
304
341
*/
You can’t perform that action at this time.
0 commit comments