Skip to content

Commit 549087f

Browse files
committed
Test custom import callbacks
1 parent f1b97c0 commit 549087f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/ApiTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ public function testUserFunction() {
1717
$this->compile("result: add-two(10, 20);"),
1818
"result: 30;");
1919
}
20+
21+
public function testImportMissing(){
22+
$this->assertEquals(
23+
$this->compile('@import "missing";'),
24+
'@import "missing";');
25+
}
26+
27+
public function testImportCustomCallback(){
28+
$this->scss->addImportPath(function($path) {
29+
return 'inputs/' . str_replace('.css','.scss',$path);
30+
});
31+
32+
$this->assertEquals(
33+
$this->compile('@import "variables.css";'),
34+
trim(file_get_contents('outputs/variables.css')));
35+
}
2036

2137
public function compile($str) {
2238
return trim($this->scss->compile($str));

0 commit comments

Comments
 (0)