|
5 | 5 | use Sabberworm\CSS\Value\Size; |
6 | 6 | use Sabberworm\CSS\Property\Selector; |
7 | 7 | use Sabberworm\CSS\RuleSet\AtRule; |
| 8 | +use Sabberworm\CSS\CSSList\KeyFrame; |
8 | 9 |
|
9 | 10 | class ParserTest extends \PHPUnit_Framework_TestCase { |
10 | 11 |
|
@@ -149,14 +150,24 @@ function testSpecificity() { |
149 | 150 |
|
150 | 151 | function testManipulation() { |
151 | 152 | $oDoc = $this->parsedStructureForFile('atrules'); |
152 | | - $this->assertSame('@charset "utf-8";@font-face {font-family: "CrassRoots";src: url("../media/cr.ttf");}html, body {font-size: 1.6em;}' . "\n", $oDoc->__toString()); |
| 153 | + $this->assertSame('@charset "utf-8";@font-face {font-family: "CrassRoots";src: url("../media/cr.ttf");}html, body {font-size: 1.6em;} |
| 154 | +@keyframes mymove {from {top: 0px;} |
| 155 | +to {top: 200px;} |
| 156 | +}@-moz-keyframes some-move {from {top: 0px;} |
| 157 | +to {top: 200px;} |
| 158 | +}', $oDoc->__toString()); |
153 | 159 | foreach ($oDoc->getAllDeclarationBlocks() as $oBlock) { |
154 | 160 | foreach ($oBlock->getSelectors() as $oSelector) { |
155 | 161 | //Loop over all selector parts (the comma-separated strings in a selector) and prepend the id |
156 | 162 | $oSelector->setSelector('#my_id ' . $oSelector->getSelector()); |
157 | 163 | } |
158 | 164 | } |
159 | | - $this->assertSame('@charset "utf-8";@font-face {font-family: "CrassRoots";src: url("../media/cr.ttf");}#my_id html, #my_id body {font-size: 1.6em;}' . "\n", $oDoc->__toString()); |
| 165 | + $this->assertSame('@charset "utf-8";@font-face {font-family: "CrassRoots";src: url("../media/cr.ttf");}#my_id html, #my_id body {font-size: 1.6em;} |
| 166 | +@keyframes mymove {from {top: 0px;} |
| 167 | +to {top: 200px;} |
| 168 | +}@-moz-keyframes some-move {from {top: 0px;} |
| 169 | +to {top: 200px;} |
| 170 | +}', $oDoc->__toString()); |
160 | 171 |
|
161 | 172 | $oDoc = $this->parsedStructureForFile('values'); |
162 | 173 | $this->assertSame('#header {margin: 10px 2em 1cm 2%;font-family: Verdana,Helvetica,"Gill Sans",sans-serif;font-size: 10px;color: red !important;} |
@@ -252,9 +263,9 @@ function testPrefixedGradient() { |
252 | 263 | function testListValueRemoval() { |
253 | 264 | $oDoc = $this->parsedStructureForFile('atrules'); |
254 | 265 | foreach ($oDoc->getContents() as $oItem) { |
255 | | - if ($oItem instanceof AtRule) { |
| 266 | + if ($oItem instanceof AtRule || $oItem instanceof KeyFrame) { |
256 | 267 | $oDoc->remove($oItem); |
257 | | - break; |
| 268 | + continue; |
258 | 269 | } |
259 | 270 | } |
260 | 271 | $this->assertSame('@charset "utf-8";html, body {font-size: 1.6em;}' . "\n", $oDoc->__toString()); |
|
0 commit comments