Merge pull request #10326 from nextcloud/svg-api-suf-fixes

Fix regex of iconsCacher
This commit is contained in:
Morris Jobke 2018-07-24 13:36:39 +02:00 committed by GitHub
commit f7c7ff5f85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 8 deletions

View file

@ -63,12 +63,11 @@
.app-files #app-content {
transition: background-color 0.3s ease;
overflow-x: hidden;
}
.file-drag, .file-drag #filestable tbody tr, .file-drag #filestable tbody tr:hover {
transition: background-color 0.3s ease!important;
background-color: rgb(179, 230, 255)!important;
background-color: rgb(179, 230, 255) !important;
}
.app-files #app-content.dir-drop {
@ -91,7 +90,7 @@
@include icon-color('recent', 'files', $color-black);
}
.nav-icon-favorites {
@include icon-color('star-dark', 'files', $color-black, 2, true);
@include icon-color('star-dark', 'actions', $color-black, 2, true);
}
.nav-icon-sharingin,
.nav-icon-sharingout,

View file

@ -606,7 +606,6 @@ kbd {
position: relative;
min-height: 100%;
flex-basis: 100vw;
overflow: auto;
/* margin if navigation element is here */
#app-navigation + & {
margin-left: $navigation-width;

View file

@ -175,7 +175,7 @@ body {
-ms-user-select: none;
user-select: none;
display: flex;
top: 0;
top: $header-height;
}
/* position controls for apps with app-navigation */

View file

@ -47,7 +47,7 @@ class IconsCacher {
protected $urlGenerator;
/** @var string */
private $iconVarRE = '/--(icon-[a-z0-9-]+): url\(["\']([a-z0-9-_\~\/\?\&\=\.]+)[^;]+;/m';
private $iconVarRE = '/--(icon-[a-zA-Z0-9-]+): url\(["\']([a-z0-9-_\~\/\.]+)[^;]+;/m';
/** @var string */
private $fileName = 'icons-vars.css';

View file

@ -80,7 +80,7 @@ class IconsCacherTest extends \Test\TestCase {
public function testGetIconsFromValidCss() {
$css = "
icon.test {
--icon-test: url('/svg/core/actions/add/000');
--icon-test: url('/svg/core/actions/add/000?v=1');
background-image: var(--icon-test);
}
";
@ -104,7 +104,7 @@ class IconsCacherTest extends \Test\TestCase {
public function testSetIconsFromValidCss() {
$css = "
icon.test {
--icon-test: url('/svg/core/actions/add/000');
--icon-test: url('/svg/core/actions/add/000?v=1');
background-image: var(--icon-test);
}
";
@ -124,4 +124,29 @@ class IconsCacherTest extends \Test\TestCase {
$this->assertEquals($expected, $actual);
}
public function testSetIconsFromValidCssMultipleTimes() {
$css = "
icon.test {
--icon-test: url('/svg/core/actions/add/000?v=1');
background-image: var(--icon-test);
}
";
$expected = "
icon.test {
background-image: var(--icon-test);
}
";
$iconsFile = $this->createMock(ISimpleFile::class);
$this->folder->expects($this->exactly(3))
->method('getFile')
->willReturn($iconsFile);
$actual = $this->iconsCacher->setIconsCss($css);
$actual = $this->iconsCacher->setIconsCss($actual);
$actual = $this->iconsCacher->setIconsCss($actual);
$this->assertEquals($expected, $actual);
}
}