Skip to content

Commit

Permalink
consolidate all share attributes into one attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
edoparearyee committed Aug 5, 2015
1 parent 14ba4e2 commit 1a8e356
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
15 changes: 1 addition & 14 deletions app/js/addthis.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ angular.module("sn.addthis", [])
restrict: "EAC",
replace: false,
scope: {
url: "@",
title: "@",
description: "@",
share: "="
},
link: function ($scope, $element) {

Expand All @@ -70,17 +68,6 @@ angular.module("sn.addthis", [])
*/
$scope.config = $window.addthis_config ? $window.addthis_config : {}; // jshint ignore:line

/**
* {@link http://support.addthis.com/customer/portal/articles/1337996-the-addthis_share-variable}
* @property share
* @type {Object}
*/
$scope.share = {
url: $scope.url,
title : $scope.title,
description : $scope.description
};

/**
* Removes the stock addthis buttons
* @method removeStockButtons
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/addthis.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("directive: snAddthisToolbox", function() {
timeout = $injector.get("$timeout");

element =
"<sn-addthis-toolbox data-url=\"http://www.my-domain.com\" data-title=\"My Website\" data-description=\"foo bar\">" +
"<sn-addthis-toolbox data-share=\"{ url: 'http://www.my-domain.com', title: 'My Website', description: 'foo bar' }\">" +
"<a href class=\"addthis_button_facebook\">Facebook</a>" +
"<a href class=\"addthis_button_twitter\">Twitter</a>" +
"</sn-addthis-toolbox>";
Expand Down Expand Up @@ -46,9 +46,9 @@ describe("directive: snAddthisToolbox", function() {
describe("no existing config data", function() {

it("should attach directive options to scope", function (){
expect(isolatedScope.url).toEqual("http://www.my-domain.com");
expect(isolatedScope.title).toEqual("My Website");
expect(isolatedScope.description).toEqual("foo bar");
expect(isolatedScope.share.url).toEqual("http://www.my-domain.com");
expect(isolatedScope.share.title).toEqual("My Website");
expect(isolatedScope.share.description).toEqual("foo bar");
});

it("should attempt to remove stock addthis buttons", function (){
Expand Down

0 comments on commit 1a8e356

Please sign in to comment.