first commit
This commit is contained in:
27
vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/CSSList/AtRuleBlockListTest.php
vendored
Normal file
27
vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/CSSList/AtRuleBlockListTest.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Sabberworm\CSS\CSSList;
|
||||
|
||||
use Sabberworm\CSS\Parser;
|
||||
|
||||
class AtRuleBlockListTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
public function testMediaQueries() {
|
||||
$sCss = '@media(min-width: 768px){.class{color:red}}';
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
$aContents = $oDoc->getContents();
|
||||
$oMediaQuery = $aContents[0];
|
||||
$this->assertSame('media', $oMediaQuery->atRuleName(), 'Does not interpret the type as a function');
|
||||
$this->assertSame('(min-width: 768px)', $oMediaQuery->atRuleArgs(), 'The media query is the value');
|
||||
|
||||
$sCss = '@media (min-width: 768px) {.class{color:red}}';
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
$aContents = $oDoc->getContents();
|
||||
$oMediaQuery = $aContents[0];
|
||||
$this->assertSame('media', $oMediaQuery->atRuleName(), 'Does not interpret the type as a function');
|
||||
$this->assertSame('(min-width: 768px)', $oMediaQuery->atRuleArgs(), 'The media query is the value');
|
||||
}
|
||||
|
||||
}
|
||||
26
vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/CSSList/DocumentTest.php
vendored
Normal file
26
vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/CSSList/DocumentTest.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Sabberworm\CSS\CSSList;
|
||||
|
||||
use Sabberworm\CSS\Parser;
|
||||
|
||||
class DocumentTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
public function testOverrideContents() {
|
||||
$sCss = '.thing { left: 10px; }';
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
$aContents = $oDoc->getContents();
|
||||
$this->assertCount(1, $aContents);
|
||||
|
||||
$sCss2 = '.otherthing { right: 10px; }';
|
||||
$oParser2 = new Parser($sCss);
|
||||
$oDoc2 = $oParser2->parse();
|
||||
$aContents2 = $oDoc2->getContents();
|
||||
|
||||
$oDoc->setContents(array($aContents[0], $aContents2[0]));
|
||||
$aFinalContents = $oDoc->getContents();
|
||||
$this->assertCount(2, $aFinalContents);
|
||||
}
|
||||
|
||||
}
|
||||
170
vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/OutputFormatTest.php
vendored
Normal file
170
vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/OutputFormatTest.php
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
namespace Sabberworm\CSS;
|
||||
|
||||
use Sabberworm\CSS\Parser;
|
||||
use Sabberworm\CSS\OutputFormat;
|
||||
|
||||
global $TEST_CSS;
|
||||
|
||||
$TEST_CSS = <<<EOT
|
||||
|
||||
.main, .test {
|
||||
font: italic normal bold 16px/1.2 "Helvetica", Verdana, sans-serif;
|
||||
background: white;
|
||||
}
|
||||
|
||||
@media screen {
|
||||
.main {
|
||||
background-size: 100% 100%;
|
||||
font-size: 1.3em;
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
EOT;
|
||||
|
||||
class OutputFormatTest extends \PHPUnit_Framework_TestCase {
|
||||
private $oParser;
|
||||
private $oDocument;
|
||||
|
||||
function setUp() {
|
||||
global $TEST_CSS;
|
||||
$this->oParser = new Parser($TEST_CSS);
|
||||
$this->oDocument = $this->oParser->parse();
|
||||
}
|
||||
|
||||
public function testPlain() {
|
||||
$this->assertSame('.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
|
||||
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render());
|
||||
}
|
||||
|
||||
public function testCompact() {
|
||||
$this->assertSame('.main,.test{font:italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background:white;}@media screen{.main{background-size:100% 100%;font-size:1.3em;background-color:#fff;}}', $this->oDocument->render(OutputFormat::createCompact()));
|
||||
}
|
||||
|
||||
public function testPretty() {
|
||||
global $TEST_CSS;
|
||||
$this->assertSame($TEST_CSS, $this->oDocument->render(OutputFormat::createPretty()));
|
||||
}
|
||||
|
||||
public function testSpaceAfterListArgumentSeparator() {
|
||||
$this->assertSame('.main, .test {font: italic normal bold 16px/ 1.2 "Helvetica", Verdana, sans-serif;background: white;}
|
||||
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setSpaceAfterListArgumentSeparator(" ")));
|
||||
}
|
||||
|
||||
public function testSpaceAfterListArgumentSeparatorComplex() {
|
||||
$this->assertSame('.main, .test {font: italic normal bold 16px/1.2 "Helvetica", Verdana, sans-serif;background: white;}
|
||||
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setSpaceAfterListArgumentSeparator(array('default' => ' ', ',' => "\t", '/' => '', ' ' => ''))));
|
||||
}
|
||||
|
||||
public function testSpaceAfterSelectorSeparator() {
|
||||
$this->assertSame('.main,
|
||||
.test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
|
||||
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setSpaceAfterSelectorSeparator("\n")));
|
||||
}
|
||||
|
||||
public function testStringQuotingType() {
|
||||
$this->assertSame('.main, .test {font: italic normal bold 16px/1.2 \'Helvetica\',Verdana,sans-serif;background: white;}
|
||||
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setStringQuotingType("'")));
|
||||
}
|
||||
|
||||
public function testRGBHashNotation() {
|
||||
$this->assertSame('.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
|
||||
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: rgb(255,255,255);}}', $this->oDocument->render(OutputFormat::create()->setRGBHashNotation(false)));
|
||||
}
|
||||
|
||||
public function testSemicolonAfterLastRule() {
|
||||
$this->assertSame('.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white}
|
||||
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff}}', $this->oDocument->render(OutputFormat::create()->setSemicolonAfterLastRule(false)));
|
||||
}
|
||||
|
||||
public function testSpaceAfterRuleName() {
|
||||
$this->assertSame('.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
|
||||
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setSpaceAfterRuleName("\t")));
|
||||
}
|
||||
|
||||
public function testSpaceRules() {
|
||||
$this->assertSame('.main, .test {
|
||||
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
|
||||
background: white;
|
||||
}
|
||||
@media screen {.main {
|
||||
background-size: 100% 100%;
|
||||
font-size: 1.3em;
|
||||
background-color: #fff;
|
||||
}}', $this->oDocument->render(OutputFormat::create()->set('Space*Rules', "\n")));
|
||||
}
|
||||
|
||||
public function testSpaceBlocks() {
|
||||
$this->assertSame('
|
||||
.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
|
||||
@media screen {
|
||||
.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}
|
||||
}
|
||||
', $this->oDocument->render(OutputFormat::create()->set('Space*Blocks', "\n")));
|
||||
}
|
||||
|
||||
public function testSpaceBoth() {
|
||||
$this->assertSame('
|
||||
.main, .test {
|
||||
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
|
||||
background: white;
|
||||
}
|
||||
@media screen {
|
||||
.main {
|
||||
background-size: 100% 100%;
|
||||
font-size: 1.3em;
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
', $this->oDocument->render(OutputFormat::create()->set('Space*Rules', "\n")->set('Space*Blocks', "\n")));
|
||||
}
|
||||
|
||||
public function testSpaceBetweenBlocks() {
|
||||
$this->assertSame('.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setSpaceBetweenBlocks('')));
|
||||
}
|
||||
|
||||
public function testIndentation() {
|
||||
$this->assertSame('
|
||||
.main, .test {
|
||||
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
|
||||
background: white;
|
||||
}
|
||||
@media screen {
|
||||
.main {
|
||||
background-size: 100% 100%;
|
||||
font-size: 1.3em;
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
', $this->oDocument->render(OutputFormat::create()->set('Space*Rules', "\n")->set('Space*Blocks', "\n")->setIndentation('')));
|
||||
}
|
||||
|
||||
public function testSpaceBeforeBraces() {
|
||||
$this->assertSame('.main, .test{font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
|
||||
@media screen{.main{background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setSpaceBeforeOpeningBrace('')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Sabberworm\CSS\Parsing\OutputException
|
||||
*/
|
||||
public function testIgnoreExceptionsOff() {
|
||||
$aBlocks = $this->oDocument->getAllDeclarationBlocks();
|
||||
$oFirstBlock = $aBlocks[0];
|
||||
$oFirstBlock->removeSelector('.main');
|
||||
$this->assertSame('.test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
|
||||
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setIgnoreExceptions(false)));
|
||||
$oFirstBlock->removeSelector('.test');
|
||||
$this->oDocument->render(OutputFormat::create()->setIgnoreExceptions(false));
|
||||
}
|
||||
|
||||
public function testIgnoreExceptionsOn() {
|
||||
$aBlocks = $this->oDocument->getAllDeclarationBlocks();
|
||||
$oFirstBlock = $aBlocks[0];
|
||||
$oFirstBlock->removeSelector('.main');
|
||||
$oFirstBlock->removeSelector('.test');
|
||||
$this->assertSame('@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setIgnoreExceptions(true)));
|
||||
}
|
||||
|
||||
}
|
||||
714
vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/ParserTest.php
vendored
Normal file
714
vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/ParserTest.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
267
vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/RuleSet/DeclarationBlockTest.php
vendored
Normal file
267
vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/RuleSet/DeclarationBlockTest.php
vendored
Normal file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
|
||||
namespace Sabberworm\CSS\RuleSet;
|
||||
|
||||
use Sabberworm\CSS\Parser;
|
||||
use Sabberworm\CSS\Rule\Rule;
|
||||
use Sabberworm\CSS\Value\Size;
|
||||
|
||||
class DeclarationBlockTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* @dataProvider expandBorderShorthandProvider
|
||||
* */
|
||||
public function testExpandBorderShorthand($sCss, $sExpected) {
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
|
||||
$oDeclaration->expandBorderShorthand();
|
||||
}
|
||||
$this->assertSame(trim((string) $oDoc), $sExpected);
|
||||
}
|
||||
|
||||
public function expandBorderShorthandProvider() {
|
||||
return array(
|
||||
array('body{ border: 2px solid #000 }', 'body {border-width: 2px;border-style: solid;border-color: #000;}'),
|
||||
array('body{ border: none }', 'body {border-style: none;}'),
|
||||
array('body{ border: 2px }', 'body {border-width: 2px;}'),
|
||||
array('body{ border: #f00 }', 'body {border-color: #f00;}'),
|
||||
array('body{ border: 1em solid }', 'body {border-width: 1em;border-style: solid;}'),
|
||||
array('body{ margin: 1em; }', 'body {margin: 1em;}')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider expandFontShorthandProvider
|
||||
* */
|
||||
public function testExpandFontShorthand($sCss, $sExpected) {
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
|
||||
$oDeclaration->expandFontShorthand();
|
||||
}
|
||||
$this->assertSame(trim((string) $oDoc), $sExpected);
|
||||
}
|
||||
|
||||
public function expandFontShorthandProvider() {
|
||||
return array(
|
||||
array(
|
||||
'body{ margin: 1em; }',
|
||||
'body {margin: 1em;}'
|
||||
),
|
||||
array(
|
||||
'body {font: 12px serif;}',
|
||||
'body {font-style: normal;font-variant: normal;font-weight: normal;font-size: 12px;line-height: normal;font-family: serif;}'
|
||||
),
|
||||
array(
|
||||
'body {font: italic 12px serif;}',
|
||||
'body {font-style: italic;font-variant: normal;font-weight: normal;font-size: 12px;line-height: normal;font-family: serif;}'
|
||||
),
|
||||
array(
|
||||
'body {font: italic bold 12px serif;}',
|
||||
'body {font-style: italic;font-variant: normal;font-weight: bold;font-size: 12px;line-height: normal;font-family: serif;}'
|
||||
),
|
||||
array(
|
||||
'body {font: italic bold 12px/1.6 serif;}',
|
||||
'body {font-style: italic;font-variant: normal;font-weight: bold;font-size: 12px;line-height: 1.6;font-family: serif;}'
|
||||
),
|
||||
array(
|
||||
'body {font: italic small-caps bold 12px/1.6 serif;}',
|
||||
'body {font-style: italic;font-variant: small-caps;font-weight: bold;font-size: 12px;line-height: 1.6;font-family: serif;}'
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider expandBackgroundShorthandProvider
|
||||
* */
|
||||
public function testExpandBackgroundShorthand($sCss, $sExpected) {
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
|
||||
$oDeclaration->expandBackgroundShorthand();
|
||||
}
|
||||
$this->assertSame(trim((string) $oDoc), $sExpected);
|
||||
}
|
||||
|
||||
public function expandBackgroundShorthandProvider() {
|
||||
return array(
|
||||
array('body {border: 1px;}', 'body {border: 1px;}'),
|
||||
array('body {background: #f00;}', 'body {background-color: #f00;background-image: none;background-repeat: repeat;background-attachment: scroll;background-position: 0% 0%;}'),
|
||||
array('body {background: #f00 url("foobar.png");}', 'body {background-color: #f00;background-image: url("foobar.png");background-repeat: repeat;background-attachment: scroll;background-position: 0% 0%;}'),
|
||||
array('body {background: #f00 url("foobar.png") no-repeat;}', 'body {background-color: #f00;background-image: url("foobar.png");background-repeat: no-repeat;background-attachment: scroll;background-position: 0% 0%;}'),
|
||||
array('body {background: #f00 url("foobar.png") no-repeat center;}', 'body {background-color: #f00;background-image: url("foobar.png");background-repeat: no-repeat;background-attachment: scroll;background-position: center center;}'),
|
||||
array('body {background: #f00 url("foobar.png") no-repeat top left;}', 'body {background-color: #f00;background-image: url("foobar.png");background-repeat: no-repeat;background-attachment: scroll;background-position: top left;}'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider expandDimensionsShorthandProvider
|
||||
* */
|
||||
public function testExpandDimensionsShorthand($sCss, $sExpected) {
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
|
||||
$oDeclaration->expandDimensionsShorthand();
|
||||
}
|
||||
$this->assertSame(trim((string) $oDoc), $sExpected);
|
||||
}
|
||||
|
||||
public function expandDimensionsShorthandProvider() {
|
||||
return array(
|
||||
array('body {border: 1px;}', 'body {border: 1px;}'),
|
||||
array('body {margin-top: 1px;}', 'body {margin-top: 1px;}'),
|
||||
array('body {margin: 1em;}', 'body {margin-top: 1em;margin-right: 1em;margin-bottom: 1em;margin-left: 1em;}'),
|
||||
array('body {margin: 1em 2em;}', 'body {margin-top: 1em;margin-right: 2em;margin-bottom: 1em;margin-left: 2em;}'),
|
||||
array('body {margin: 1em 2em 3em;}', 'body {margin-top: 1em;margin-right: 2em;margin-bottom: 3em;margin-left: 2em;}'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider createBorderShorthandProvider
|
||||
* */
|
||||
public function testCreateBorderShorthand($sCss, $sExpected) {
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
|
||||
$oDeclaration->createBorderShorthand();
|
||||
}
|
||||
$this->assertSame(trim((string) $oDoc), $sExpected);
|
||||
}
|
||||
|
||||
public function createBorderShorthandProvider() {
|
||||
return array(
|
||||
array('body {border-width: 2px;border-style: solid;border-color: #000;}', 'body {border: 2px solid #000;}'),
|
||||
array('body {border-style: none;}', 'body {border: none;}'),
|
||||
array('body {border-width: 1em;border-style: solid;}', 'body {border: 1em solid;}'),
|
||||
array('body {margin: 1em;}', 'body {margin: 1em;}')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider createFontShorthandProvider
|
||||
* */
|
||||
public function testCreateFontShorthand($sCss, $sExpected) {
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
|
||||
$oDeclaration->createFontShorthand();
|
||||
}
|
||||
$this->assertSame(trim((string) $oDoc), $sExpected);
|
||||
}
|
||||
|
||||
public function createFontShorthandProvider() {
|
||||
return array(
|
||||
array('body {font-size: 12px; font-family: serif}', 'body {font: 12px serif;}'),
|
||||
array('body {font-size: 12px; font-family: serif; font-style: italic;}', 'body {font: italic 12px serif;}'),
|
||||
array('body {font-size: 12px; font-family: serif; font-style: italic; font-weight: bold;}', 'body {font: italic bold 12px serif;}'),
|
||||
array('body {font-size: 12px; font-family: serif; font-style: italic; font-weight: bold; line-height: 1.6;}', 'body {font: italic bold 12px/1.6 serif;}'),
|
||||
array('body {font-size: 12px; font-family: serif; font-style: italic; font-weight: bold; line-height: 1.6; font-variant: small-caps;}', 'body {font: italic small-caps bold 12px/1.6 serif;}'),
|
||||
array('body {margin: 1em;}', 'body {margin: 1em;}')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider createDimensionsShorthandProvider
|
||||
* */
|
||||
public function testCreateDimensionsShorthand($sCss, $sExpected) {
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
|
||||
$oDeclaration->createDimensionsShorthand();
|
||||
}
|
||||
$this->assertSame(trim((string) $oDoc), $sExpected);
|
||||
}
|
||||
|
||||
public function createDimensionsShorthandProvider() {
|
||||
return array(
|
||||
array('body {border: 1px;}', 'body {border: 1px;}'),
|
||||
array('body {margin-top: 1px;}', 'body {margin-top: 1px;}'),
|
||||
array('body {margin-top: 1em; margin-right: 1em; margin-bottom: 1em; margin-left: 1em;}', 'body {margin: 1em;}'),
|
||||
array('body {margin-top: 1em; margin-right: 2em; margin-bottom: 1em; margin-left: 2em;}', 'body {margin: 1em 2em;}'),
|
||||
array('body {margin-top: 1em; margin-right: 2em; margin-bottom: 3em; margin-left: 2em;}', 'body {margin: 1em 2em 3em;}'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider createBackgroundShorthandProvider
|
||||
* */
|
||||
public function testCreateBackgroundShorthand($sCss, $sExpected) {
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
|
||||
$oDeclaration->createBackgroundShorthand();
|
||||
}
|
||||
$this->assertSame(trim((string) $oDoc), $sExpected);
|
||||
}
|
||||
|
||||
public function createBackgroundShorthandProvider() {
|
||||
return array(
|
||||
array('body {border: 1px;}', 'body {border: 1px;}'),
|
||||
array('body {background-color: #f00;}', 'body {background: #f00;}'),
|
||||
array('body {background-color: #f00;background-image: url(foobar.png);}', 'body {background: #f00 url("foobar.png");}'),
|
||||
array('body {background-color: #f00;background-image: url(foobar.png);background-repeat: no-repeat;}', 'body {background: #f00 url("foobar.png") no-repeat;}'),
|
||||
array('body {background-color: #f00;background-image: url(foobar.png);background-repeat: no-repeat;}', 'body {background: #f00 url("foobar.png") no-repeat;}'),
|
||||
array('body {background-color: #f00;background-image: url(foobar.png);background-repeat: no-repeat;background-position: center;}', 'body {background: #f00 url("foobar.png") no-repeat center;}'),
|
||||
array('body {background-color: #f00;background-image: url(foobar.png);background-repeat: no-repeat;background-position: top left;}', 'body {background: #f00 url("foobar.png") no-repeat top left;}'),
|
||||
);
|
||||
}
|
||||
|
||||
public function testOverrideRules() {
|
||||
$sCss = '.wrapper { left: 10px; text-align: left; }';
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
$oRule = new Rule('right');
|
||||
$oRule->setValue('-10px');
|
||||
$aContents = $oDoc->getContents();
|
||||
$oWrapper = $aContents[0];
|
||||
|
||||
$this->assertCount(2, $oWrapper->getRules());
|
||||
$aContents[0]->setRules(array($oRule));
|
||||
|
||||
$aRules = $oWrapper->getRules();
|
||||
$this->assertCount(1, $aRules);
|
||||
$this->assertEquals('right', $aRules[0]->getRule());
|
||||
$this->assertEquals('-10px', $aRules[0]->getValue());
|
||||
}
|
||||
|
||||
public function testRuleInsertion() {
|
||||
$sCss = '.wrapper { left: 10px; text-align: left; }';
|
||||
$oParser = new Parser($sCss);
|
||||
$oDoc = $oParser->parse();
|
||||
$aContents = $oDoc->getContents();
|
||||
$oWrapper = $aContents[0];
|
||||
|
||||
$oFirst = $oWrapper->getRules('left');
|
||||
$this->assertCount(1, $oFirst);
|
||||
$oFirst = $oFirst[0];
|
||||
|
||||
$oSecond = $oWrapper->getRules('text-');
|
||||
$this->assertCount(1, $oSecond);
|
||||
$oSecond = $oSecond[0];
|
||||
|
||||
$oBefore = new Rule('left');
|
||||
$oBefore->setValue(new Size(16, 'em'));
|
||||
|
||||
$oMiddle = new Rule('text-align');
|
||||
$oMiddle->setValue(new Size(1));
|
||||
|
||||
$oAfter = new Rule('border-bottom-width');
|
||||
$oAfter->setValue(new Size(1, 'px'));
|
||||
|
||||
$oWrapper->addRule($oAfter);
|
||||
$oWrapper->addRule($oBefore, $oFirst);
|
||||
$oWrapper->addRule($oMiddle, $oSecond);
|
||||
|
||||
$aRules = $oWrapper->getRules();
|
||||
|
||||
$this->assertSame($oBefore, $aRules[0]);
|
||||
$this->assertSame($oFirst, $aRules[1]);
|
||||
$this->assertSame($oMiddle, $aRules[2]);
|
||||
$this->assertSame($oSecond, $aRules[3]);
|
||||
$this->assertSame($oAfter, $aRules[4]);
|
||||
|
||||
$this->assertSame('.wrapper {left: 16em;left: 10px;text-align: 1;text-align: left;border-bottom-width: 1px;}', $oDoc->render());
|
||||
}
|
||||
|
||||
}
|
||||
76
vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/RuleSet/LenientParsingTest.php
vendored
Normal file
76
vendor/sabberworm/php-css-parser/tests/Sabberworm/CSS/RuleSet/LenientParsingTest.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Sabberworm\CSS\RuleSet;
|
||||
|
||||
use Sabberworm\CSS\Parser;
|
||||
use Sabberworm\CSS\Settings;
|
||||
|
||||
class LenientParsingTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
|
||||
*/
|
||||
public function testFaultToleranceOff() {
|
||||
$sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-fault-tolerance.css";
|
||||
$oParser = new Parser(file_get_contents($sFile), Settings::create()->beStrict());
|
||||
$oParser->parse();
|
||||
}
|
||||
|
||||
public function testFaultToleranceOn() {
|
||||
$sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-fault-tolerance.css";
|
||||
$oParser = new Parser(file_get_contents($sFile), Settings::create()->withLenientParsing(true));
|
||||
$oResult = $oParser->parse();
|
||||
$this->assertSame('.test1 {}'."\n".'.test2 {hello: 2.2;hello: 2000000000000.2;}'."\n".'#test {}'."\n".'#test2 {help: none;}', $oResult->render());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
|
||||
*/
|
||||
public function testEndToken() {
|
||||
$sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-end-token.css";
|
||||
$oParser = new Parser(file_get_contents($sFile), Settings::create()->beStrict());
|
||||
$oParser->parse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
|
||||
*/
|
||||
public function testEndToken2() {
|
||||
$sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-end-token-2.css";
|
||||
$oParser = new Parser(file_get_contents($sFile), Settings::create()->beStrict());
|
||||
$oParser->parse();
|
||||
}
|
||||
|
||||
public function testEndTokenPositive() {
|
||||
$sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-end-token.css";
|
||||
$oParser = new Parser(file_get_contents($sFile), Settings::create()->withLenientParsing(true));
|
||||
$oResult = $oParser->parse();
|
||||
$this->assertSame("", $oResult->render());
|
||||
}
|
||||
|
||||
public function testEndToken2Positive() {
|
||||
$sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-end-token-2.css";
|
||||
$oParser = new Parser(file_get_contents($sFile), Settings::create()->withLenientParsing(true));
|
||||
$oResult = $oParser->parse();
|
||||
$this->assertSame('#home .bg-layout {background-image: url("/bundles/main/img/bg1.png?5");}', $oResult->render());
|
||||
}
|
||||
|
||||
public function testLocaleTrap() {
|
||||
setlocale(LC_ALL, "pt_PT", "no");
|
||||
$sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-fault-tolerance.css";
|
||||
$oParser = new Parser(file_get_contents($sFile), Settings::create()->withLenientParsing(true));
|
||||
$oResult = $oParser->parse();
|
||||
$this->assertSame('.test1 {}'."\n".'.test2 {hello: 2.2;hello: 2000000000000.2;}'."\n".'#test {}'."\n".'#test2 {help: none;}', $oResult->render());
|
||||
}
|
||||
|
||||
public function testCaseInsensitivity() {
|
||||
$sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "case-insensitivity.css";
|
||||
$oParser = new Parser(file_get_contents($sFile));
|
||||
$oResult = $oParser->parse();
|
||||
$this->assertSame('@charset "utf-8";
|
||||
@import url("test.css");
|
||||
@media screen {}
|
||||
#myid {case: insensitive !important;frequency: 30Hz;font-size: 1em;color: #ff0;color: hsl(40,40%,30%);font-family: Arial;}', $oResult->render());
|
||||
}
|
||||
|
||||
}
|
||||
10
vendor/sabberworm/php-css-parser/tests/bootstrap.php
vendored
Normal file
10
vendor/sabberworm/php-css-parser/tests/bootstrap.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function($class)
|
||||
{
|
||||
$file = __DIR__.'/../lib/'.strtr($class, '\\', '/').'.php';
|
||||
if (file_exists($file)) {
|
||||
require $file;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
1
vendor/sabberworm/php-css-parser/tests/files/-calc-no-space-around-minus.css
vendored
Normal file
1
vendor/sabberworm/php-css-parser/tests/files/-calc-no-space-around-minus.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
div { width: calc(50% -8px); }
|
||||
5
vendor/sabberworm/php-css-parser/tests/files/-charset-after-rule.css
vendored
Normal file
5
vendor/sabberworm/php-css-parser/tests/files/-charset-after-rule.css
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#id {
|
||||
prop: var(--val);
|
||||
}
|
||||
|
||||
@charset 'utf-16';
|
||||
3
vendor/sabberworm/php-css-parser/tests/files/-charset-in-block.css
vendored
Normal file
3
vendor/sabberworm/php-css-parser/tests/files/-charset-in-block.css
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
@media print {
|
||||
@charset 'utf-16';
|
||||
}
|
||||
1
vendor/sabberworm/php-css-parser/tests/files/-empty-grid-linename.css
vendored
Normal file
1
vendor/sabberworm/php-css-parser/tests/files/-empty-grid-linename.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.test { grid-template-columns: [] 100px; }
|
||||
0
vendor/sabberworm/php-css-parser/tests/files/-empty.css
vendored
Normal file
0
vendor/sabberworm/php-css-parser/tests/files/-empty.css
vendored
Normal file
1
vendor/sabberworm/php-css-parser/tests/files/-end-token-2.css
vendored
Normal file
1
vendor/sabberworm/php-css-parser/tests/files/-end-token-2.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#home .bg-layout { background-image: url(/bundles/main/img/bg1.png?5);};
|
||||
1
vendor/sabberworm/php-css-parser/tests/files/-end-token.css
vendored
Normal file
1
vendor/sabberworm/php-css-parser/tests/files/-end-token.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/* Test comment
|
||||
15
vendor/sabberworm/php-css-parser/tests/files/-fault-tolerance.css
vendored
Normal file
15
vendor/sabberworm/php-css-parser/tests/files/-fault-tolerance.css
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
.test1 {
|
||||
//gaga: hello;
|
||||
}
|
||||
|
||||
.test2 {
|
||||
*hello: 1;
|
||||
hello: 2.2;
|
||||
hello: 2000000000000.2;
|
||||
}
|
||||
|
||||
#test {
|
||||
#hello: 1}
|
||||
|
||||
#test2 {
|
||||
help: none;
|
||||
9
vendor/sabberworm/php-css-parser/tests/files/-tobedone.css
vendored
Normal file
9
vendor/sabberworm/php-css-parser/tests/files/-tobedone.css
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
.some[selectors-may='contain-a-{'] {
|
||||
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 200px) {
|
||||
.test {
|
||||
prop: val;
|
||||
}
|
||||
}
|
||||
10
vendor/sabberworm/php-css-parser/tests/files/1readme.css
vendored
Normal file
10
vendor/sabberworm/php-css-parser/tests/files/1readme.css
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
@charset "utf-8";
|
||||
|
||||
@font-face {
|
||||
font-family: "CrassRoots";
|
||||
src: url("../media/cr.ttf")
|
||||
}
|
||||
|
||||
html, body {
|
||||
font-size: 1.6em
|
||||
}
|
||||
5
vendor/sabberworm/php-css-parser/tests/files/2readme.css
vendored
Normal file
5
vendor/sabberworm/php-css-parser/tests/files/2readme.css
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#header {
|
||||
margin: 10px 2em 1cm 2%;
|
||||
font-family: Verdana, Helvetica, "Gill Sans", sans-serif;
|
||||
color: red !important;
|
||||
}
|
||||
57
vendor/sabberworm/php-css-parser/tests/files/atrules.css
vendored
Normal file
57
vendor/sabberworm/php-css-parser/tests/files/atrules.css
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
@charset "utf-8";
|
||||
|
||||
@font-face {
|
||||
font-family: "CrassRoots";
|
||||
src: url("../media/cr.ttf")
|
||||
}
|
||||
|
||||
html, body {
|
||||
font-size: -0.6em
|
||||
}
|
||||
|
||||
@keyframes mymove {
|
||||
from { top: 0px; }
|
||||
to { top: 200px; }
|
||||
}
|
||||
|
||||
@-moz-keyframes some-move {
|
||||
from { top: 0px; }
|
||||
to { top: 200px; }
|
||||
}
|
||||
|
||||
@supports ( (perspective: 10px) or (-moz-perspective: 10px) or (-webkit-perspective: 10px) or (-ms-perspective: 10px) or (-o-perspective: 10px) ) {
|
||||
body {
|
||||
font-family: 'Helvetica';
|
||||
}
|
||||
}
|
||||
|
||||
@page :pseudo-class {
|
||||
margin:2in;
|
||||
}
|
||||
|
||||
@-moz-document url(http://www.w3.org/),
|
||||
url-prefix(http://www.w3.org/Style/),
|
||||
domain(mozilla.org),
|
||||
regexp("https:.*") {
|
||||
/* CSS rules here apply to:
|
||||
+ The page "http://www.w3.org/".
|
||||
+ Any page whose URL begins with "http://www.w3.org/Style/"
|
||||
+ Any page whose URL's host is "mozilla.org" or ends with
|
||||
".mozilla.org"
|
||||
+ Any page whose URL starts with "https:" */
|
||||
|
||||
/* make the above-mentioned pages really ugly */
|
||||
body { color: purple; background: yellow; }
|
||||
}
|
||||
|
||||
@media screen and (orientation: landscape) {
|
||||
@-ms-viewport {
|
||||
width: 1024px;
|
||||
height: 768px;
|
||||
}
|
||||
/* CSS for landscape layout goes here */
|
||||
}
|
||||
|
||||
@region-style #intro {
|
||||
p { color: blue; }
|
||||
}
|
||||
4
vendor/sabberworm/php-css-parser/tests/files/calc-nested.css
vendored
Normal file
4
vendor/sabberworm/php-css-parser/tests/files/calc-nested.css
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.test {
|
||||
font-size: calc((3 * 4px) + -2px);
|
||||
top: calc(200px - calc(20 * 3px));
|
||||
}
|
||||
6
vendor/sabberworm/php-css-parser/tests/files/calc.css
vendored
Normal file
6
vendor/sabberworm/php-css-parser/tests/files/calc.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
div { width: calc(100% / 4); }
|
||||
div { margin-top: calc(-120% - 4px); }
|
||||
div {
|
||||
height: -webkit-calc(9/16 * 100%)!important;
|
||||
width: -moz-calc((50px - 50%)*2);
|
||||
}
|
||||
15
vendor/sabberworm/php-css-parser/tests/files/case-insensitivity.css
vendored
Normal file
15
vendor/sabberworm/php-css-parser/tests/files/case-insensitivity.css
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
@CharSet "utf-8";
|
||||
@IMPORT uRL(test.css);
|
||||
|
||||
@MEDIA screen {
|
||||
|
||||
}
|
||||
|
||||
#myid {
|
||||
CaSe: insensitive !imPORTANT;
|
||||
frequency: 30hz;
|
||||
font-size: 1EM;
|
||||
color: RGB(255, 255, 0);
|
||||
color: hSL(40, 40%, 30%);
|
||||
font-Family: Arial; /* The value needs to remain capitalized */
|
||||
}
|
||||
12
vendor/sabberworm/php-css-parser/tests/files/colortest.css
vendored
Normal file
12
vendor/sabberworm/php-css-parser/tests/files/colortest.css
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
#mine {
|
||||
color: red;
|
||||
border-color: rgb(10, 100, 230);
|
||||
border-color: rgba(10, 100, 231, 0.3);
|
||||
outline-color: #222;
|
||||
background-color: #232323;
|
||||
}
|
||||
|
||||
#yours {
|
||||
background-color: hsl(220, 10%, 220%);
|
||||
background-color: hsla(220, 10%, 220%, 0.3);
|
||||
}
|
||||
17
vendor/sabberworm/php-css-parser/tests/files/comments.css
vendored
Normal file
17
vendor/sabberworm/php-css-parser/tests/files/comments.css
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Comments Hell.
|
||||
*/
|
||||
@import /* Number 1 */"some/url.css"/* Number 2 */ screen/* Number 3 */;
|
||||
|
||||
.foo, /* Number 4 */ #bar/* Number 5 */ {
|
||||
background-color/* Number 6 */: #000/* Number 7 */;
|
||||
}
|
||||
|
||||
@media /* Number 8 */screen /* Number 9 */{
|
||||
/** Number 10 **/
|
||||
#foo.bar {
|
||||
/** Number 10b **/
|
||||
position: absolute;/**/
|
||||
}
|
||||
}
|
||||
/** Number 11 **/
|
||||
6
vendor/sabberworm/php-css-parser/tests/files/create-shorthands.css
vendored
Normal file
6
vendor/sabberworm/php-css-parser/tests/files/create-shorthands.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
body {
|
||||
font-size: 2em; font-family: Helvetica,Arial,sans-serif; font-weight: bold;
|
||||
border-width: 2px; border-color: #999; border-style: dotted;
|
||||
background-color: #fff; background-image: url('foobar.png'); background-repeat: repeat-y;
|
||||
margin-top: 2px; margin-right: 3px; margin-bottom: 4px; margin-left: 5px;
|
||||
}
|
||||
1
vendor/sabberworm/php-css-parser/tests/files/docuwiki.css
vendored
Normal file
1
vendor/sabberworm/php-css-parser/tests/files/docuwiki.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
div.dokuwiki div.ajax_qsearch{position:absolute;right:237px;;width:200px;opacity:0.9;display:none;font-size:80%;line-height:1.2em;border:1px solid #8cacbb;background-color:#f7f9fa;text-align:left;padding:4px;}
|
||||
1
vendor/sabberworm/php-css-parser/tests/files/empty-grid-linename.css
vendored
Normal file
1
vendor/sabberworm/php-css-parser/tests/files/empty-grid-linename.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.test { grid-template-columns: [] 100px; }
|
||||
7
vendor/sabberworm/php-css-parser/tests/files/expand-shorthands.css
vendored
Normal file
7
vendor/sabberworm/php-css-parser/tests/files/expand-shorthands.css
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
body {
|
||||
font: italic 500 14px/1.618 "Trebuchet MS", Georgia, serif;
|
||||
border: 2px solid #f0f;
|
||||
background: #ccc url("/images/foo.png") no-repeat left top;
|
||||
margin: 1em !important;
|
||||
padding: 2px 6px 3px;
|
||||
}
|
||||
21
vendor/sabberworm/php-css-parser/tests/files/functions.css
vendored
Normal file
21
vendor/sabberworm/php-css-parser/tests/files/functions.css
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
div.main { background-image: linear-gradient(#000, #fff) }
|
||||
.collapser::before,
|
||||
.collapser::-moz-before,
|
||||
.collapser::-webkit-before {
|
||||
content: "»";
|
||||
font-size: 1.2em;
|
||||
margin-right: .2em;
|
||||
-moz-transition-property: -moz-transform;
|
||||
-moz-transition-duration: .2s;
|
||||
-moz-transform-origin: center 60%;
|
||||
}
|
||||
.collapser.expanded::before,
|
||||
.collapser.expanded::-moz-before,
|
||||
.collapser.expanded::-webkit-before { -moz-transform: rotate(90deg) }
|
||||
.collapser + * {
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
-moz-transition-property: height;
|
||||
-moz-transition-duration: .3s;
|
||||
}
|
||||
.collapser.expanded + * { height: auto }
|
||||
2
vendor/sabberworm/php-css-parser/tests/files/grid-linename.css
vendored
Normal file
2
vendor/sabberworm/php-css-parser/tests/files/grid-linename.css
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
div { grid-template-columns: [ linename ] 100px; }
|
||||
span { grid-template-columns: [ linename1 linename2 ] 100px; }
|
||||
2
vendor/sabberworm/php-css-parser/tests/files/hex-alpha.css
vendored
Normal file
2
vendor/sabberworm/php-css-parser/tests/files/hex-alpha.css
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
div { background: #1234; }
|
||||
div { background: #11223344; }
|
||||
9
vendor/sabberworm/php-css-parser/tests/files/ie-hacks.css
vendored
Normal file
9
vendor/sabberworm/php-css-parser/tests/files/ie-hacks.css
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
p {
|
||||
padding-right: .75rem \9;
|
||||
background-image: none \9;
|
||||
color:red\9\0;
|
||||
background-color:red \9 \0;
|
||||
background-color:red \9 \0 !important;
|
||||
content: "red \9\0";
|
||||
content: "red\0abc";
|
||||
}
|
||||
6
vendor/sabberworm/php-css-parser/tests/files/ie.css
vendored
Normal file
6
vendor/sabberworm/php-css-parser/tests/files/ie.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
.nav-thumb-wrapper:hover img, a.activeSlide img {
|
||||
filter: alpha(opacity=100);
|
||||
-moz-opacity: 1;
|
||||
-khtml-opacity: 1;
|
||||
opacity: 1;
|
||||
}
|
||||
8
vendor/sabberworm/php-css-parser/tests/files/important.css
vendored
Normal file
8
vendor/sabberworm/php-css-parser/tests/files/important.css
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
div.rating-cancel,div.star-rating{float:left;width:17px;height:15px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
|
||||
div.rating-cancel,div.rating-cancel a{background:url(images/delete.gif) no-repeat 0 -16px}
|
||||
div.star-rating,div.star-rating a{background:url(images/star.gif) no-repeat 0 0px}
|
||||
div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 0px;border:0}
|
||||
div.star-rating-on a{background-position:0 -16px!important}
|
||||
div.star-rating-hover a{background-position:0 -32px}
|
||||
div.star-rating-readonly a{cursor:default !important}
|
||||
div.star-rating{background:transparent!important; overflow:hidden!important}
|
||||
3
vendor/sabberworm/php-css-parser/tests/files/inner-color.css
vendored
Normal file
3
vendor/sabberworm/php-css-parser/tests/files/inner-color.css
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
test {
|
||||
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#006cad), to(hsl(202, 100%, 49%)));
|
||||
}
|
||||
32
vendor/sabberworm/php-css-parser/tests/files/line-numbers.css
vendored
Normal file
32
vendor/sabberworm/php-css-parser/tests/files/line-numbers.css
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
@charset "utf-8"; /* line 1 */
|
||||
|
||||
@namespace "http://toto.example.org"; /* line 3 */
|
||||
|
||||
@font-face { /* line 5 */
|
||||
font-family: "CrassRoots";
|
||||
src: url("http://example.com/media/cr.ttf") /* line 7 */
|
||||
}
|
||||
|
||||
|
||||
#header { /* line 11 */
|
||||
margin: 10px 2em 1cm 2%;
|
||||
font-family: Verdana, Helvetica, "Gill Sans", sans-serif;
|
||||
color: red !important;
|
||||
}
|
||||
|
||||
@keyframes mymove { /* line 17 */
|
||||
from { top: 0px; } /* line 18 */
|
||||
|
||||
to { top: 200px; } /* line 20 */
|
||||
}
|
||||
|
||||
@IMPORT uRL(test.css); /* line 23 */
|
||||
|
||||
body {
|
||||
background: #FFFFFF url("http://somesite.com/images/someimage.gif") repeat top center; /* line 25 */
|
||||
color: rgb( /* line 27 */
|
||||
233, /* line 28 */
|
||||
100, /* line 29 */
|
||||
450 /* line 30 */
|
||||
);
|
||||
}
|
||||
4
vendor/sabberworm/php-css-parser/tests/files/missing-property-value.css
vendored
Normal file
4
vendor/sabberworm/php-css-parser/tests/files/missing-property-value.css
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
div {
|
||||
display: inline-block;
|
||||
display:
|
||||
}
|
||||
1
vendor/sabberworm/php-css-parser/tests/files/ms-filter.css
vendored
Normal file
1
vendor/sabberworm/php-css-parser/tests/files/ms-filter.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.test {filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);}
|
||||
18
vendor/sabberworm/php-css-parser/tests/files/namespaces.css
vendored
Normal file
18
vendor/sabberworm/php-css-parser/tests/files/namespaces.css
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/* From the spec at http://www.w3.org/TR/css3-namespace/ */
|
||||
|
||||
@namespace toto "http://toto.example.org";
|
||||
@namespace "http://example.com/foo";
|
||||
|
||||
|
||||
/* From an introduction at http://www.blooberry.com/indexdot/css/syntax/atrules/namespace.htm */
|
||||
@namespace foo url("http://www.example.com/");
|
||||
@namespace foo url('http://www.example.com/');
|
||||
|
||||
|
||||
foo|test {
|
||||
gaga: 1;
|
||||
}
|
||||
|
||||
|test {
|
||||
gaga: 2;
|
||||
}
|
||||
17
vendor/sabberworm/php-css-parser/tests/files/nested.css
vendored
Normal file
17
vendor/sabberworm/php-css-parser/tests/files/nested.css
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
html {
|
||||
some: -test(val1);
|
||||
}
|
||||
|
||||
html {
|
||||
some-other: -test(val1);
|
||||
}
|
||||
|
||||
@media screen {
|
||||
html {
|
||||
some: -test(val2);
|
||||
}
|
||||
}
|
||||
|
||||
#unrelated {
|
||||
other: yes;
|
||||
}
|
||||
4
vendor/sabberworm/php-css-parser/tests/files/slashed.css
vendored
Normal file
4
vendor/sabberworm/php-css-parser/tests/files/slashed.css
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.test {
|
||||
font: 12px/1.5 Verdana, Arial, sans-serif;
|
||||
border-radius: 5px 10px 5px 10px / 10px 5px 10px 5px;
|
||||
}
|
||||
7
vendor/sabberworm/php-css-parser/tests/files/specificity.css
vendored
Normal file
7
vendor/sabberworm/php-css-parser/tests/files/specificity.css
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#test .help,
|
||||
#file,
|
||||
.help:hover,
|
||||
li.green,
|
||||
ol li::before {
|
||||
font-family: Helvetica;
|
||||
}
|
||||
2
vendor/sabberworm/php-css-parser/tests/files/trailing-whitespace.css
vendored
Normal file
2
vendor/sabberworm/php-css-parser/tests/files/trailing-whitespace.css
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
div { width: 200px; }
|
||||
|
||||
3
vendor/sabberworm/php-css-parser/tests/files/unicode-range.css
vendored
Normal file
3
vendor/sabberworm/php-css-parser/tests/files/unicode-range.css
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
@font-face {
|
||||
unicode-range: U+0100-024F, U+0259, U+1E??-2EFF, U+202F;
|
||||
}
|
||||
12
vendor/sabberworm/php-css-parser/tests/files/unicode.css
vendored
Normal file
12
vendor/sabberworm/php-css-parser/tests/files/unicode.css
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
.test-1 { content: "\20"; } /* Same as " " */
|
||||
.test-2 { content: "\E9"; } /* Same as "é" */
|
||||
.test-3 { content: "\0020"; } /* Same as " " */
|
||||
.test-5 { content: "\6C34" } /* Same as "水" */
|
||||
.test-6 { content: "\00A5" } /* Same as "¥" */
|
||||
.test-7 { content: '\a' } /* Same as "\A" (Newline) */
|
||||
.test-8 { content: "\"\22" } /* Same as "\"\"" */
|
||||
.test-9 { content: "\"\27" } /* Same as ""\"\'"" */
|
||||
.test-10 { content: "\'\\" } /* Same as "'\" */
|
||||
.test-11 { content: "\test" } /* Same as "test" */
|
||||
|
||||
.test-4 { content: "\1D11E" } /* Beyond the Basic Multilingual Plane */
|
||||
18
vendor/sabberworm/php-css-parser/tests/files/unmatched_braces.css
vendored
Normal file
18
vendor/sabberworm/php-css-parser/tests/files/unmatched_braces.css
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
button,input,checkbox,textarea {
|
||||
outline: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio:3/@media all and (orientation:portrait) {
|
||||
#wrapper {
|
||||
max-width:640px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (orientation: landscape) {
|
||||
#wrapper {
|
||||
max-width:640px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
3
vendor/sabberworm/php-css-parser/tests/files/unopened-close-brackets.css
vendored
Normal file
3
vendor/sabberworm/php-css-parser/tests/files/unopened-close-brackets.css
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
}}}.blue{
|
||||
background: #00F;
|
||||
}
|
||||
4
vendor/sabberworm/php-css-parser/tests/files/url.css
vendored
Normal file
4
vendor/sabberworm/php-css-parser/tests/files/url.css
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
body { background: #FFFFFF url("http://somesite.com/images/someimage.gif") repeat top center; }
|
||||
body {
|
||||
background-url: url("http://somesite.com/images/someimage.gif");
|
||||
}
|
||||
14
vendor/sabberworm/php-css-parser/tests/files/values.css
vendored
Normal file
14
vendor/sabberworm/php-css-parser/tests/files/values.css
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
#header {
|
||||
margin: 10px 2em 1cm 2%;
|
||||
font-family: Verdana, Helvetica, "Gill Sans", sans-serif;
|
||||
font-size: 10px;
|
||||
color: red !important;
|
||||
background-color: green;
|
||||
background-color: rgba(0,128,0,0.7);
|
||||
frequency: 30Hz;
|
||||
}
|
||||
|
||||
body {
|
||||
color: green;
|
||||
font: 75% "Lucida Grande", "Trebuchet MS", Verdana, sans-serif;
|
||||
}
|
||||
1
vendor/sabberworm/php-css-parser/tests/files/webkit.css
vendored
Normal file
1
vendor/sabberworm/php-css-parser/tests/files/webkit.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.test { background:-webkit-linear-gradient(top right, white, black)}
|
||||
3
vendor/sabberworm/php-css-parser/tests/files/whitespace.css
vendored
Normal file
3
vendor/sabberworm/php-css-parser/tests/files/whitespace.css
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.test {
|
||||
background-image : url ( 4px ) ;
|
||||
}
|
||||
1
vendor/sabberworm/php-css-parser/tests/phpunit.xml
vendored
Normal file
1
vendor/sabberworm/php-css-parser/tests/phpunit.xml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<phpunit bootstrap="bootstrap.php"></phpunit>
|
||||
20
vendor/sabberworm/php-css-parser/tests/quickdump.php
vendored
Executable file
20
vendor/sabberworm/php-css-parser/tests/quickdump.php
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__).'/bootstrap.php');
|
||||
|
||||
$sSource = file_get_contents('php://stdin');
|
||||
$oParser = new Sabberworm\CSS\Parser($sSource);
|
||||
|
||||
$oDoc = $oParser->parse();
|
||||
echo "\n".'#### Input'."\n\n```css\n";
|
||||
print $sSource;
|
||||
|
||||
echo "\n```\n\n".'#### Structure (`var_dump()`)'."\n\n```php\n";
|
||||
var_dump($oDoc);
|
||||
|
||||
echo "\n```\n\n".'#### Output (`render()`)'."\n\n```css\n";
|
||||
print $oDoc->render();
|
||||
|
||||
echo "\n```\n";
|
||||
|
||||
Reference in New Issue
Block a user