diff --git a/Gemfile b/Gemfile index 7788961..dedbbef 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,2 @@ source 'https://rubygems.org' -gem 'sass', '~> 3.4.6' +gem 'sass', '~> 3.4' diff --git a/Gemfile.lock b/Gemfile.lock index 07fd731..eb9a29f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,10 @@ GEM remote: https://rubygems.org/ specs: - sass (3.4.6) + sass (3.4.13) PLATFORMS ruby DEPENDENCIES - sass (~> 3.4.6) + sass (~> 3.4) diff --git a/bower.json b/bower.json index 58c9805..c797927 100644 --- a/bower.json +++ b/bower.json @@ -1,14 +1,14 @@ { "name": "atrackt", "dependencies": { - "jquery": "~2.1.1", - "jquery.scrollTo": "~1.4.13" + "jquery": "~2", + "jquery.scrollTo": "~1" }, "devDependencies": { - "chai": "~1.9.1", - "chai-as-promised": "~4.1.1", - "mocha": "~1.21.4", - "sinon": "~1.10.3", - "sinon-chai": "~2.5.0" + "chai": "~1", + "chai-as-promised": "~4", + "mocha": "~1", + "sinon": "~1", + "sinon-chai": "~2" } } diff --git a/demo/atrackt_demo.js b/demo/atrackt_demo.js index 4736844..7be9e86 100644 --- a/demo/atrackt_demo.js +++ b/demo/atrackt_demo.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.8.0 +// Generated by CoffeeScript 1.9.0 (function() { $(function() { Atrackt.setPlugin('Demo Plugin', { diff --git a/lib/atrackt.console.js b/lib/atrackt.console.js index 7f578e2..f240aae 100644 --- a/lib/atrackt.console.js +++ b/lib/atrackt.console.js @@ -1,15 +1,15 @@ -// Generated by CoffeeScript 1.8.0 +// Generated by CoffeeScript 1.9.0 /* Atrackt Tracking Library https://github.com/brewster1134/atrackt -@version 1.0.5 +@version 1.0.0 @author Ryan Brewster */ (function() { - var __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + var __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + __hasProp = {}.hasOwnProperty; (function(root, factory) { if (typeof define === 'function' && define.amd) { diff --git a/lib/atrackt.js b/lib/atrackt.js index 65766c5..4706e9a 100644 --- a/lib/atrackt.js +++ b/lib/atrackt.js @@ -1,9 +1,9 @@ -// Generated by CoffeeScript 1.8.0 +// Generated by CoffeeScript 1.9.0 /* Atrackt Tracking Library https://github.com/brewster1134/atrackt -@version 1.0.2 +@version 1.0.8 @author Ryan Brewster */ @@ -33,10 +33,10 @@ https://github.com/brewster1134/atrackt Atrackt.prototype.setPlugin = function(pluginName, plugin) { if (!pluginName) { - throw 'ATRACKT ERROR: `setPlugin` - No plugin name defined'; + throw new Error('ATRACKT ERROR: `setPlugin` - No plugin name defined'); } - if (typeof (plugin != null ? plugin.send : void 0) !== 'function') { - throw "ATRACKT ERROR: `setPlugin` - No send method was defined for `" + pluginName + "`."; + if (!(plugin && typeof plugin.send === 'function')) { + throw new Error("ATRACKT ERROR: `setPlugin` - No send method was defined for `" + pluginName + "`."); } pluginName = pluginName.toLowerCase().replace(/[^a-z]/g, '-'); this.plugins[pluginName] = plugin; @@ -78,7 +78,7 @@ https://github.com/brewster1134/atrackt context = this; } if (!eventsObject) { - throw 'ATRACKT ERROR: `setEvent` - You must pass a valid event object.'; + throw new Error('ATRACKT ERROR: `setEvent` - You must pass a valid event object.'); } _results = []; for (eventType in eventsObject) { @@ -153,7 +153,7 @@ https://github.com/brewster1134/atrackt } allowedCallbacks = ['before', 'after']; if (allowedCallbacks.indexOf(name) === -1) { - throw "ATRACKT ERROR: `setCallback` - `" + name + "` is not a valid callback. Only callbacks allowed are: " + (allowedCallbacks.join(', ')); + throw new Error("ATRACKT ERROR: `setCallback` - `" + name + "` is not a valid callback. Only callbacks allowed are: " + (allowedCallbacks.join(', '))); } (_base = context._callbacks)[name] || (_base[name] = []); return context._callbacks[name].push(callback); @@ -223,7 +223,7 @@ https://github.com/brewster1134/atrackt var callback, metaData, optionsCopy, trackingData, trackingOptions, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3, _results; metaData = this._getTrackObject(data, event); if (!metaData) { - throw 'ATRACKT ERROR: `track` - Only valid selectors, jquery objects, or html nodes are supported.'; + throw new Error('ATRACKT ERROR: `track` - Only valid selectors, jquery objects, or html nodes are supported.'); } trackingData = $.extend(true, {}, this._data, plugin._data, options['_data'] || {}, metaData); optionsCopy = $.extend(true, {}, options, options[plugin.name] || {}); diff --git a/lib/plugins/atrackt.localytics.js b/lib/plugins/atrackt.localytics.js index b3d7a7a..4a02d53 100644 --- a/lib/plugins/atrackt.localytics.js +++ b/lib/plugins/atrackt.localytics.js @@ -1,4 +1,4 @@ -// Generated by CoffeeScript 1.8.0 +// Generated by CoffeeScript 1.9.0 /* Atrackt Localytics Plugin diff --git a/lib/plugins/atrackt.omniture.js b/lib/plugins/atrackt.omniture.js index b1ac95f..3a93e58 100644 --- a/lib/plugins/atrackt.omniture.js +++ b/lib/plugins/atrackt.omniture.js @@ -1,10 +1,10 @@ -// Generated by CoffeeScript 1.8.0 +// Generated by CoffeeScript 1.9.0 /* Atrackt Omniture Plugin https://github.com/brewster1134/atrackt @author Ryan Brewster -@version 1.0.5 +@version 1.0.6 */ (function() { @@ -36,8 +36,8 @@ https://github.com/brewster1134/atrackt }, send: function(data, options) { var arg, _ref, _ref1; - if (typeof s === 'undefined') { - return console.error('ATRACKT ERROR: PLUGIN `omniture` - Site catalyst library not loaded'); + if (typeof s === "undefined" || s === null) { + return; } $.extend(true, this.options, options); data._categories = (_ref = data._categories) != null ? _ref.join(this.options.delimiters.category) : void 0; @@ -90,9 +90,6 @@ https://github.com/brewster1134/atrackt _keyLookup: function(key) { var _newKey; _newKey = this.options.propMap[key]; - if (!_newKey) { - console.error("ATRACKT ERROR: PLUGIN `omniture` - No mapping for `" + key + "` in omniture config"); - } return _newKey || key; } }); diff --git a/spec/atrackt_spec.coffee b/spec/atrackt_spec.coffee index 7dd5b94..209aee2 100644 --- a/spec/atrackt_spec.coffee +++ b/spec/atrackt_spec.coffee @@ -1,10 +1,17 @@ # Setup plugin # + +# create plugin to test with Atrackt.setPlugin 'Foo Plugin', send: -> _plugin = Atrackt.plugins['foo-plugin'] describe 'Atrackt', -> + before -> + # make sure the foo plugin is the only registered plugin + Atrackt.plugins = + 'foo-plugin': _plugin + it 'should set the Atrackt object on window', -> expect(window.Atrackt).to.exist diff --git a/spec/index.html b/spec/index.html index 23cda1c..bb8c365 100644 --- a/spec/index.html +++ b/spec/index.html @@ -1,45 +1,61 @@ - -
-