tests_issues.php in Sassy 7
File
phamlp/tests/tests_issues.php
View source
<?php
include "test_inc.php";
class IssuesTest extends ScssUnitTest {
public function test_lighten_darken() {
$tests = array(
'{ color: lighten(#B8860B, 3%); }' => 'color: #c6910c;',
'{ color: darken(#b8860b, 3%); }' => 'color: #aa7b0a;',
'{ color: lighten(#99FF99, 8%); }' => 'color: #c2ffc2;',
'{ color: darken(#99FF99, 8%); }' => 'color: #70ff70;',
'{ color: lighten(#A4D9E4, 6%); }' => 'color: #bce3eb;',
'{ color: darken(#A4D9E4, 6%); }' => 'color: #8ccfdd;',
'{ color: lighten(#806918, 26%); }' => 'color: #dbb941;',
'{ color: darken(#806918, 8%); }' => 'color: #5e4d12;',
);
$this
->assertScss(array_keys($tests), array_values($tests));
}
public function test_extend_issue54() {
$source = <<<END
\$test-var: 1;
@mixin catch-my-error(\$align: right) {
\t\$align: unquote(\$align);
\t@if \$align == right {
\t\t.test-right-cls {
\t\t\ttext-align: right;
}
}
\t@else if \$align == left {
\t\t.test-left-cls {
\t\t\ttext-align: left;
}
}
@else {
\t\t.test-else-cls {
\t\t\ttext-align: none;
}
}
}
.cls-1 {
\t@include catch-my-error(right);
}
.cls-2 {
\t@include catch-my-error(left);
}
.cls-3 {
\t@if \$test-var == 2 {
\t\tpadding: 10px;
}
\t@else if \$test-var == 1 {
\t\t.test-1-cls {
\t\t\tpadding: 0;
}
}
}
END;
$expected = <<<END
.cls-1 .test-right-cls {
text-align: right;
}
.cls-2 .test-left-cls {
text-align: left;
}
.cls-3 .test-1-cls {
padding: 0;
}
END;
$this
->assertScss($source, $expected);
}
}
$unit = new IssuesTest();
$unit
->run();