Skip to content

Commit 12c945f

Browse files
committed
Add test for multiline color rule
1 parent 134ee42 commit 12c945f

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

tests/Sabberworm/CSS/ParserTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Sabberworm\CSS\RuleSet\DeclarationBlock;
99
use Sabberworm\CSS\Property\AtRule;
1010
use Sabberworm\CSS\Value\URL;
11+
use Sabberworm\CSS\Value\Color;
1112

1213
class ParserTest extends \PHPUnit_Framework_TestCase {
1314

@@ -471,6 +472,22 @@ function testLineNumbersParsing() {
471472
$aUrlActual[] = $oValue->getLineNo();
472473
}
473474
}
475+
476+
// Checking for the multiline color rule lines 27-31
477+
$aExpectedColorLines = array(28, 29, 30);
478+
$aDeclBlocks = $oDoc->getAllDeclarationBlocks();
479+
// Choose the 2nd one
480+
$oDeclBlock = $aDeclBlocks[1];
481+
$aRules = $oDeclBlock->getRules();
482+
// Choose the 2nd one
483+
$oColor = $aRules[1]->getValue();
484+
$this->assertEquals($aRules[1]->getLineNo(), 27);
485+
486+
foreach ($oColor->getColor() as $oSize) {
487+
$aActualColorLines[] = $oSize->getLineNo();
488+
}
489+
490+
$this->assertEquals($aExpectedColorLines, $aActualColorLines);
474491
$this->assertEquals($aUrlExpected, $aUrlActual);
475492
$this->assertEquals($aExpected, $aActual);
476493
}

tests/files/line-numbers.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@
2424

2525
body {
2626
background: #FFFFFF url("http://somesite.com/images/someimage.gif") repeat top center; /* line 25 */
27-
color: rgb(233, 100, 450);
27+
color: rgb( /* line 27 */
28+
233, /* line 28 */
29+
100, /* line 29 */
30+
450 /* line 30 */
31+
);
2832
}

0 commit comments

Comments
 (0)