Tests: Add less parser nested variables test cases

This commit is contained in:
Yonas Habteab 2022-06-29 09:45:51 +02:00 committed by Johannes Meyer
parent 5a04480245
commit 1ec6913a04
1 changed files with 53 additions and 0 deletions

View File

@ -60,6 +60,59 @@ LESS
);
}
public function testNestedVariables()
{
$this->assertEquals(
<<<CSS
.black {
color: var(--my-color, var(--black, #000000));
}
.notBlack {
color: var(--my-black-color, var(--my-color, var(--black, #000000)));
}
CSS
,
$this->compileLess(<<<LESS
@black: black;
@my-color: @black;
@my-black-color: @my-color;
.black {
color: @my-color;
}
.notBlack {
color: @my-black-color;
}
LESS
)
);
}
public function testDefiningVariablesWithLessCallables()
{
$this->assertEquals(
<<<CSS
.my-rule {
color: var(--fade-color, rgba(221, 221, 221, 0.5));
}
CSS
,
$this->compileLess(<<<LESS
@color: #ddd;
@my-color: @color;
@fade-color: fade(@my-color, 50%);
.my-rule {
color: @fade-color;
}
LESS
)
);
}
public function testVariablesUsedInFunctions()
{
$this->assertEquals(