Permalink
Browse files

Core: Fix *.svg image support

Fixes #57
  • Loading branch information...
1 parent dd15a7d commit 40b7eb3363ce5a5e82eb91ce5b71c2430b8f5273 @tabalinas committed Sep 14, 2016
Showing with 19 additions and 2 deletions.
  1. +1 −1 src/jssocials.js
  2. +1 −1 src/jssocials.shares.js
  3. +17 −0 test/jssocials.tests.js
View
@@ -10,7 +10,7 @@
return value;
};
- var IMG_SRC_REGEX = /(\.(jpeg|png|gif|bmp|svg\+xml)$|^data:image\/(jpeg|png|gif|bmp|svg\+xml);base64)/i;
+ var IMG_SRC_REGEX = /(\.(jpeg|png|gif|bmp|svg)$|^data:image\/(jpeg|png|gif|bmp|svg\+xml);base64)/i;
var URL_PARAMS_REGEX = /(&?[a-zA-Z0-9]+=)?\{([a-zA-Z0-9]+)\}/g;
var MEASURES = {
@@ -109,7 +109,7 @@
label: "Pocket",
logo: "fa fa-get-pocket",
shareUrl: "https://getpocket.com/save?url={url}&title={title}",
- countUrl: "",
+ countUrl: ""
},
messenger: {
@@ -277,6 +277,23 @@
assert.equal($shareLogo.attr("src"), imgBase64, "img has base64 src");
});
+ QUnit.test("logo as svg image", function(assert) {
+ jsSocials.shares.testshare = {
+ shareUrl: "http://test.com/share"
+ };
+
+ var $element = $("#share").jsSocials({
+ shares: [{
+ share: "testshare",
+ logo: "test.svg"
+ }]
+ });
+
+ var $shareLogo = $element.find(".jssocials-share-logo");
+ assert.equal($shareLogo.get(0).tagName, "IMG", "<img> tag is rendered");
+ assert.equal($shareLogo.attr("src"), "test.svg", "img has svg image path");
+ });
+
QUnit.test("share should get sharing url and text", function(assert) {
jsSocials.shares.testshare = {
shareUrl: "http://test.com/share/?url={url}&text={text}"

0 comments on commit 40b7eb3

Please sign in to comment.