Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regex of iconsCacher #10326

Merged
merged 4 commits into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}

}