summaryrefslogtreecommitdiffstats
path: root/core/js/tests/specs
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-04-04 11:32:07 +0200
committerVincent Petry <pvince81@owncloud.com>2014-04-04 11:34:26 +0200
commita4eafca77f86ab2630bec698c3302c93daddb991 (patch)
treed19954cea3761efe945e1cee0816c69fc555e94b /core/js/tests/specs
parent8a10c44eb33d45e2deba7d72b30e509fa332fb24 (diff)
downloadnextcloud-server-a4eafca77f86ab2630bec698c3302c93daddb991.tar.gz
nextcloud-server-a4eafca77f86ab2630bec698c3302c93daddb991.zip
Moved code to replace svg with png to OC.Util
- Moved code that replaces the "svg" extension for the given file to core as OC.Util.replaceSVGIcon. - Added unit test for OC.Util.replaceSVGIcon - Moved "replaceSVG" to OC.Util.replaceSVG and deprecated the global "replaceSVG" function. - Added alias for SVGSupport() as OC.Util.hasSVGSupport() (for now)
Diffstat (limited to 'core/js/tests/specs')
-rw-r--r--core/js/tests/specs/coreSpec.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js
index 94a397b7892..89056807788 100644
--- a/core/js/tests/specs/coreSpec.js
+++ b/core/js/tests/specs/coreSpec.js
@@ -448,5 +448,31 @@ describe('Core base tests', function() {
expect($navigation.is(':visible')).toEqual(true);
});
});
+ describe('SVG extension replacement', function() {
+ var svgSupportStub;
+
+ beforeEach(function() {
+ svgSupportStub = sinon.stub(OC.Util, 'hasSVGSupport');
+ });
+ afterEach(function() {
+ svgSupportStub.restore();
+ });
+ it('does not replace svg extension with png when SVG is supported', function() {
+ svgSupportStub.returns(true);
+ expect(
+ OC.Util.replaceSVGIcon('/path/to/myicon.svg?someargs=1')
+ ).toEqual(
+ '/path/to/myicon.svg?someargs=1'
+ );
+ });
+ it('replaces svg extension with png when SVG not supported', function() {
+ svgSupportStub.returns(false);
+ expect(
+ OC.Util.replaceSVGIcon('/path/to/myicon.svg?someargs=1')
+ ).toEqual(
+ '/path/to/myicon.png?someargs=1'
+ );
+ });
+ });
});