-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Svg color api #9984
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
Merged
Merged
Svg color api #9984
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
84e90e2
Svg color api
skjnldsv 98a0113
Svg from app
skjnldsv 29ff7ef
Svg icon api sass function and upgrade of all styles
skjnldsv ccd70a4
use built in response cacheFor function
skjnldsv 09f591f
Dark theme fixes
skjnldsv d904293
autoloader bump
skjnldsv 8977c71
Mixin scss icon api
skjnldsv 9e58859
Fixed icons detection and caching
skjnldsv a24cad1
Fix accessibility invert
skjnldsv cd6f00a
Only dark
skjnldsv 59db525
Autoloader bump
skjnldsv 14bc9ff
Fixed tests
skjnldsv dccfed8
Add versionning to icon svg color api function
skjnldsv 6194681
Fixed svg generator regex && added missing icons
skjnldsv 6ed8c19
Use proper URL prefix for icons
juliusknorr 9159ed3
Fix icon url regex
juliusknorr bfc6fc8
Fix settings icon fetching
juliusknorr 37a4d2b
Php code bump
skjnldsv 9d94cc1
Fix unit tests
rullzer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixed tests
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
- Loading branch information
commit 14bc9ffda4cdf42b047725b581d6a1129eb70a5b
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| <?php | ||
| /** | ||
| * @copyright Copyright (c) 2018, John Molakvoæ ([email protected]) | ||
| * | ||
| * @author John Molakvoæ (skjnldsv) <[email protected]> | ||
| * | ||
| * @license GNU AGPL version 3 or any later version | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| * | ||
| */ | ||
|
|
||
| namespace Test\Template; | ||
|
|
||
| use OC\Files\AppData\AppData; | ||
| use OC\Files\AppData\Factory; | ||
| use OC\Template\IconsCacher; | ||
| use OCA\Theming\ThemingDefaults; | ||
| use OCP\Files\IAppData; | ||
| use OCP\Files\NotFoundException; | ||
| use OCP\Files\SimpleFS\ISimpleFile; | ||
| use OCP\Files\SimpleFS\ISimpleFolder; | ||
| use OCP\ICache; | ||
| use OCP\ICacheFactory; | ||
| use OCP\IConfig; | ||
| use OCP\ILogger; | ||
| use OCP\IURLGenerator; | ||
| use OC_App; | ||
|
|
||
| class IconsCacherTest extends \Test\TestCase { | ||
| /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */ | ||
| protected $logger; | ||
| /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */ | ||
| protected $appData; | ||
| /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ | ||
| protected $urlGenerator; | ||
|
|
||
| protected function setUp() { | ||
| $this->logger = $this->createMock(ILogger::class); | ||
| $this->appData = $this->createMock(AppData::class); | ||
|
|
||
| /** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */ | ||
| $factory = $this->createMock(Factory::class); | ||
| $factory->method('get')->with('css')->willReturn($this->appData); | ||
|
|
||
| $this->folder = $this->createMock(ISimpleFolder::class); | ||
| $this->appData->method('getFolder')->willReturn($this->folder); | ||
|
|
||
| $this->urlGenerator = $this->createMock(IURLGenerator::class); | ||
|
|
||
| $this->iconsCacher = new IconsCacher( | ||
| $this->logger, | ||
| $factory, | ||
| $this->urlGenerator | ||
| ); | ||
| } | ||
|
|
||
| public function testGetIconsFromEmptyCss() { | ||
| $css = " | ||
| icon.test { | ||
| color: #aaa; | ||
| } | ||
| "; | ||
| $icons = self::invokePrivate($this->iconsCacher, 'getIconsFromCss', [$css]); | ||
| $this->assertTrue(empty($icons)); | ||
| } | ||
|
|
||
| public function testGetIconsFromValidCss() { | ||
| $css = " | ||
| icon.test { | ||
| --icon-test: url('/svg/core/actions/add/000'); | ||
| background-image: var(--icon-test); | ||
| } | ||
| "; | ||
| $actual = self::invokePrivate($this->iconsCacher, 'getIconsFromCss', [$css]); | ||
| $expected = array( | ||
| 'icon-test' => '/svg/core/actions/add/000' | ||
| ); | ||
| $this->assertEquals($expected, $actual); | ||
| } | ||
|
|
||
| public function testSetIconsFromEmptyCss() { | ||
| $expected = " | ||
| icon.test { | ||
| color: #aaa; | ||
| } | ||
| "; | ||
| $actual = $this->iconsCacher->setIconsCss($expected); | ||
| $this->assertEquals($expected, $actual); | ||
| } | ||
|
|
||
| public function testSetIconsFromValidCss() { | ||
| $css = " | ||
| icon.test { | ||
| --icon-test: url('/svg/core/actions/add/000'); | ||
| background-image: var(--icon-test); | ||
| } | ||
| "; | ||
| $expected = " | ||
| icon.test { | ||
|
|
||
| background-image: var(--icon-test); | ||
| } | ||
| "; | ||
|
|
||
| $iconsFile = $this->createMock(ISimpleFile::class); | ||
| $this->folder->expects($this->once()) | ||
| ->method('getFile') | ||
| ->willReturn($iconsFile); | ||
|
|
||
| $actual = $this->iconsCacher->setIconsCss($css); | ||
| $this->assertEquals($expected, $actual); | ||
| } | ||
|
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strict