This commit is contained in:
quamis authored and GitHub committed 2021-03-21 18:12:31 +01:00
commit e84304cbe9
16 files changed
+392 -3

No files matched your search

@@ -306,6 +306,24 @@ class WriterWithStyleTest extends TestCase
$this->assertFirstChildHasAttributeEquals(CellAlignment::RIGHT, $xfElement, 'alignment', 'horizontal');
}
/**
* @return void
*/
public function testAddRowShouldApplyShrinkToFit()
{
$fileName = 'test_add_row_should_apply_shrink_to_fit.xlsx';
$shrinkToFitStyle = (new StyleBuilder())->setShouldShrinkToFit()->build();
$dataRows = $this->createStyledRowsFromValues([['xlsx--11']], $shrinkToFitStyle);
$this->writeToXLSXFile($dataRows, $fileName);
$cellXfsDomElement = $this->getXmlSectionFromStylesXmlFile($fileName, 'cellXfs');
$xfElement = $cellXfsDomElement->getElementsByTagName('xf')->item(1);
$this->assertEquals(1, $xfElement->getAttribute('applyAlignment'));
$this->assertFirstChildHasAttributeEquals('true', $xfElement, 'alignment', 'shrinkToFit');
}
/**
* @return void
*/