Skip to content

Commit 57ae700

Browse files
committed
add test to auto invert text color
1 parent e40449e commit 57ae700

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/PhpWord/Writer/HTML/ElementTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ public function testWriteColSpan()
8585
$section = $phpWord->addSection();
8686
$table = $section->addTable();
8787
$row1 = $table->addRow();
88-
$cell11 = $row1->addCell(1000, array('gridSpan' => 2));
88+
$cell11 = $row1->addCell(1000, array('gridSpan' => 2, 'bgColor' => '6086B8'));
8989
$cell11->addText('cell spanning 2 bellow');
9090
$row2 = $table->addRow();
91-
$cell21 = $row2->addCell(500);
91+
$cell21 = $row2->addCell(500, array('bgColor' => 'ffffff'));
9292
$cell21->addText('first cell');
9393
$cell22 = $row2->addCell(500);
9494
$cell22->addText('second cell');
@@ -99,6 +99,11 @@ public function testWriteColSpan()
9999
$this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 1);
100100
$this->assertEquals('2', $xpath->query('/html/body/table/tr/td[1]')->item(0)->attributes->getNamedItem('colspan')->textContent);
101101
$this->assertTrue($xpath->query('/html/body/table/tr[2]/td')->length == 2);
102+
103+
$this->assertEquals('#6086B8', $xpath->query('/html/body/table/tr[1]/td')->item(0)->attributes->getNamedItem('bgcolor')->textContent);
104+
$this->assertEquals('#ffffff', $xpath->query('/html/body/table/tr[1]/td')->item(0)->attributes->getNamedItem('color')->textContent);
105+
$this->assertEquals('#ffffff', $xpath->query('/html/body/table/tr[2]/td')->item(0)->attributes->getNamedItem('bgcolor')->textContent);
106+
$this->assertNull($xpath->query('/html/body/table/tr[2]/td')->item(0)->attributes->getNamedItem('color'));
102107
}
103108

104109
/**

0 commit comments

Comments
 (0)