Skip to content

Commit 0b8c4fd

Browse files
committed
test: add missing test case
1 parent 8b56aad commit 0b8c4fd

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/system/View/TableTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,24 @@ public function testAddRow(): void
173173
);
174174
}
175175

176-
// Uility Methods
176+
public function testAddRowAndRowWithAttributes(): void
177+
{
178+
$cell = ['data' => 'Blue', 'class' => 'highlight', 'colspan' => 2];
179+
$this->table->addRow($cell, 'Red', 'Green');
180+
// If there is only one column `$this->table->addRow($cell)`,
181+
// this test will fail.
182+
// See https://github.com/codeigniter4/CodeIgniter4/issues/8361
183+
184+
$expected = '<table border="0" cellpadding="4" cellspacing="0">
185+
<tbody>
186+
<tr>
187+
<td colspan="2" class="highlight">Blue</td><td>Red</td><td>Green</td></tr>
188+
</tbody>
189+
</table>';
190+
$this->assertSame($expected, $this->table->generate());
191+
}
192+
193+
// Utility Methods
177194

178195
public function testPrepArgs(): void
179196
{

0 commit comments

Comments
 (0)