Skip to content

Commit

Permalink
Merge pull request #10326 from nextcloud/svg-api-suf-fixes
Browse files Browse the repository at this point in the history
Fix regex of iconsCacher
  • Loading branch information
MorrisJobke authored Jul 24, 2018
2 parents e8b0868 + f62d4d1 commit f7c7ff5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
5 changes: 2 additions & 3 deletions apps/files/css/files.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion core/css/apps.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion core/css/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Template/IconsCacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
29 changes: 27 additions & 2 deletions tests/lib/Template/IconsCacherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function testGetIconsFromEmptyCss() {
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);
}
";
Expand All @@ -104,7 +104,7 @@ public function testSetIconsFromEmptyCss() {
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);
}
";
Expand All @@ -124,4 +124,29 @@ public function testSetIconsFromValidCss() {
$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);
}

}

0 comments on commit f7c7ff5

Please sign in to comment.