File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -665,4 +665,33 @@ public function test_render_with_unicode_characters_in_cell_content(): void
665665
666666 $ this ->assertSame ($ expectedOutput , trim ($ result ));
667667 }
668+
669+ /**
670+ * Tests the rendering of table data where cell content includes formatting tags.
671+ *
672+ * Validates that the table rendering properly handles formatting tags by not including their length in the final
673+ * column width computation.
674+ *
675+ * @return void
676+ */
677+ public function test_render_with_formatting_tags_in_cell_content (): void
678+ {
679+ $ rows = [
680+ ['name ' => "<bold>Robert Smith</end> " , 'age ' => '<yellow>30</end> ' ],
681+ ['name ' => "<bold>Elizabeth Fraser</end> " , 'age ' => '<yellow>25</end> ' ],
682+ ];
683+
684+ $ expectedOutput = implode (PHP_EOL , [
685+ '+------------------+-----+ ' ,
686+ '| Name | Age | ' ,
687+ '+------------------+-----+ ' ,
688+ '| <bold>Robert Smith</end> | <yellow>30</end> | ' ,
689+ '| <bold>Elizabeth Fraser</end> | <yellow>25</end> | ' ,
690+ '+------------------+-----+ '
691+ ]);
692+
693+ $ result = $ this ->table ->render ($ rows );
694+
695+ $ this ->assertSame ($ expectedOutput , trim ($ result ));
696+ }
668697}
You can’t perform that action at this time.
0 commit comments