diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-01-29 18:12:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-29 18:12:10 +0300 |
commit | 4fcdfbf5de5496cf1fc683b6a2f4c55764de8e02 (patch) | |
tree | 2daf3982a94dec5538b5defaecf5f86280ddad6c /tests | |
parent | 01482b32a171bb8529bc8baacbe764107e52e14c (diff) | |
parent | 5dbf73339542977698e1f3ae6d22624fab74fe3e (diff) |
Merge pull request #8078 from nextcloud/theming-validate-scss
SCSS hardening
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Template/SCSSCacherTest.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/lib/Template/SCSSCacherTest.php b/tests/lib/Template/SCSSCacherTest.php index fca9500810e..7b5300b99a9 100644 --- a/tests/lib/Template/SCSSCacherTest.php +++ b/tests/lib/Template/SCSSCacherTest.php @@ -351,11 +351,21 @@ class SCSSCacherTest extends \Test\TestCase { $this->assertFalse($actual); } - public function testRebaseUrls() { + public function dataRebaseUrls() { + return [ + ['#id { background-image: url(\'../img/image.jpg\'); }','#id { background-image: url(\'/apps/files/css/../img/image.jpg\'); }'], + ['#id { background-image: url("../img/image.jpg"); }','#id { background-image: url(\'/apps/files/css/../img/image.jpg\'); }'], + ['#id { background-image: url(\'/img/image.jpg\'); }','#id { background-image: url(\'/img/image.jpg\'); }'], + ['#id { background-image: url("http://example.com/test.jpg"); }','#id { background-image: url("http://example.com/test.jpg"); }'], + ]; + } + + /** + * @dataProvider dataRebaseUrls + */ + public function testRebaseUrls($scss, $expected) { $webDir = '/apps/files/css'; - $css = '#id { background-image: url(\'../img/image.jpg\'); }'; - $actual = self::invokePrivate($this->scssCacher, 'rebaseUrls', [$css, $webDir]); - $expected = '#id { background-image: url(\'/apps/files/css/../img/image.jpg\'); }'; + $actual = self::invokePrivate($this->scssCacher, 'rebaseUrls', [$scss, $webDir]); $this->assertEquals($expected, $actual); } |