Skip to content

Commit 8decc2c

Browse files
jakejackson1claude
andcommitted
Expect a background keyword under cssMode legacy to set only the colour and image
#633 stopped the background shorthand resetting the longhands it does not name under legacy, so a keyword read as the initial value sets only the colour and the image. Legacy draws the same as on gravitypdf. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1c83a92 commit 8decc2c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎tests/Mpdf/Css/NormalizePropertiesTest.php‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,14 +896,15 @@ public function testAQuotedKeywordIsAFamilyName()
896896

897897
/**
898898
* The legacy CSS mode reads a border or background shorthand with a CSS-wide keyword as its initial value, and
899-
* leaves a keyword out of the properties it cannot read, such as font-family
899+
* leaves a keyword out of the properties it cannot read, such as font-family. As it resets no longhand the
900+
* shorthand does not name, background sets only its colour and image
900901
*/
901902
public function testTheLegacyModeReadsAKeywordShorthandAsItsInitialValue()
902903
{
903904
$this->mpdf->cssMode = CssMode::LEGACY;
904905

905906
$this->assertSame('medium none #000000', $this->normalizeProperties->normalize(['BORDER-TOP' => 'inherit'])['BORDER-TOP']);
906-
$this->assertSame(self::BACKGROUND_INITIAL_VALUES, $this->normalizeProperties->normalize(['BACKGROUND' => 'inherit']));
907+
$this->assertSame(['BACKGROUND-COLOR' => 'transparent', 'BACKGROUND-IMAGE' => ''], $this->normalizeProperties->normalize(['BACKGROUND' => 'inherit']));
907908
$this->assertSame([], $this->normalizeProperties->normalize(['FONT-FAMILY' => 'inherit']));
908909
$this->assertFalse($this->normalizeProperties->canParse('COLOR', 'revert'));
909910
}

0 commit comments

Comments
 (0)