vendor/leafo/scssphp/tests/ApiTest.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
require_once __DIR__ . "/../scss.inc.php";
class ApiTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
$this->scss = new scssc();
}
public function testUserFunction()
{
$this->scss->registerFunction("add-two", function ($args) {
list($a, $b) = $args;
return $a[1] + $b[1];
});
$this->assertEquals(
"result: 30;",
$this->compile("result: add-two(10, 20);")
);
}
public function testImportMissing()
{
$this->assertEquals(
'@import "missing";',
$this->compile('@import "missing";')
);
}
public function testImportCustomCallback()
{
$this->scss->addImportPath(function ($path) {
return __DIR__ . '/inputs/' . str_replace('.css', '.scss', $path);
});
$this->assertEquals(
trim(file_get_contents(__DIR__ . '/outputs/variables.css')),
$this->compile('@import "variables.css";')
);
}
/**
* @dataProvider provideSetVariables
*/
public function testSetVariables($expected, $scss, $variables)
{
$this->scss->setVariables($variables);
$this->assertEquals($expected, $this->compile($scss));
}
public function provideSetVariables()
{
return array(
array(
".magic {\n color: red;\n width: 760px; }",
'.magic { color: $color; width: $base - 200; }',
后面还有 20 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
