Skip to content

Commit 4fa7b72

Browse files
committed
adding first draft of a unittest
1 parent ea6ce85 commit 4fa7b72

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/Sabberworm/CSS/RuleSet/DeclarationBlockTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,27 @@ public function testRuleInsertion() {
264264
$this->assertSame('.wrapper {left: 16em;left: 10px;text-align: 1;text-align: left;border-bottom-width: 1px;}', $oDoc->render());
265265
}
266266

267+
public function testOrderOfElementsMatchingOriginalOrderAfterExpandingShorthands()
268+
{
269+
$sCss = '.rule{padding:5px;padding-top: 20px}';
270+
$oParser = new Parser($sCss);
271+
$oDoc = $oParser->parse();
272+
$aDocs = $oDoc->getAllDeclarationBlocks();
273+
274+
$this->assertCount(1, $aDocs);
275+
276+
$oDeclaration = array_pop($aDocs);
277+
$oDeclaration->expandShorthands();
278+
279+
$this->assertEqual(
280+
array(
281+
'padding-top' => 'padding-top:20px',
282+
'padding-left' => 'padding-top:5px',
283+
'padding-rigth' => 'padding-top:5px',
284+
'padding-bottom' => 'padding-top:5px',
285+
),
286+
array_map('strval', $oDeclaration->getRulesAssoc())
287+
);
288+
}
289+
267290
}

0 commit comments

Comments
 (0)