Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added some tests for coverage reports

  • Loading branch information...
commit 03fb9a2ab6106320626a75f37d07917474f018c9 1 parent c05fe6f
@davglass authored
View
16 build/gallery-bitly/gallery-bitly-coverage.js
@@ -26,7 +26,7 @@ _yuitest_coverage["build/gallery-bitly/gallery-bitly.js"] = {
path: "build/gallery-bitly/gallery-bitly.js",
code: []
};
-_yuitest_coverage["build/gallery-bitly/gallery-bitly.js"].code=["YUI.add('gallery-bitly', function (Y, NAME) {","","",""," var B = function(config) {"," B.superclass.constructor.call(this, config); "," };",""," B.NAME = 'bitly';",""," B.ATTRS = {"," username: {"," value: ''"," },"," key: {"," value: ''"," }"," };",""," Y.extend(B, Y.Base, {"," api: 'http:/'+'/api.bit.ly/',"," initializer: function() {"," if (!this.get('key') || !this.get('username')) {"," Y.error('You must give a username and an API key. If you do not have an apiKey, sign up for a bitly account and go to your Account page to get your apiKey. (http:/'+'/bit.ly/)');"," }"," },"," destructor: function() {"," },"," _buildURL: function(path, param) {"," return this.api + path + '?version=2.0.1&login=' + this.get('username') + '&apiKey=' + this.get('key') + '&' + param;"," },"," _handleAPI: function(name, url, cb) {",""," var stamp = Y.guid().replace(/-/g,'_');",""," YUI[stamp] = Y.bind(function(e) {"," if (e.results) {"," if (name == 'stats') {"," this.fire(name, e.results);"," if (cb) {"," cb = Y.bind(cb, this);"," cb(e.results);"," }"," } else {"," Y.each(e.results, function(v) {"," this.fire(name, v);"," if (cb) {"," cb = Y.bind(cb, this);"," cb(v);"," }"," }, this);"," }"," }"," delete YUI[stamp];"," }, this);"," "," Y.Get.script(url + '&callback=YUI.' + stamp);"," },"," shorten: function(url, cb) {"," var api = this._buildURL('shorten', 'longUrl=' + encodeURIComponent(url));"," this._handleAPI('shorten', api, cb);"," },"," expand: function(p, cb) {"," var path = ((p.url) ? 'shortUrl=' + encodeURIComponent(p.url) : 'hash=' + p.hash),"," api = this._buildURL('expand', path);",""," this._handleAPI('expand', api, cb);"," "," },"," expandByURL: function(v, cb) {"," return this.expand({ url: v }, cb);"," },"," expandByHash: function(v, cb) {"," return this.expand({ hash: v }, cb);"," },"," info: function(p, cb) {"," var path = ((p.url) ? 'shortUrl=' + encodeURIComponent(p.url) : 'hash=' + p.hash),"," api = this._buildURL('info', path);",""," this._handleAPI('info', api, cb);"," "," },"," infoByURL: function(v, cb) {"," return this.info({ url: v }, cb);"," },"," infoByHash: function(v, cb) {"," return this.info({ hash: v }, cb);"," },"," stats: function(p, cb) {"," var path = ((p.url) ? 'shortUrl=' + encodeURIComponent(p.url) : 'hash=' + p.hash),"," api = this._buildURL('stats', path);",""," this._handleAPI('stats', api, cb);"," "," },"," statsByURL: function(v, cb) {"," return this.stats({ url: v }, cb);"," },"," statsByHash: function(v, cb) {"," return this.stats({ hash: v }, cb);"," }"," });",""," Y.bitly = B;","","","}, '@VERSION@', {\"requires\": [\"base\", \"get\"], \"supersedes\": [], \"optional\": [], \"skinnable\": false});"];
+_yuitest_coverage["build/gallery-bitly/gallery-bitly.js"].code=["YUI.add('gallery-bitly', function (Y, NAME) {","","/*jshint maxlen: 200 */",""," var B = function(config) {"," B.superclass.constructor.call(this, config);"," };",""," B.NAME = 'bitly';",""," B.ATTRS = {"," username: {"," value: ''"," },"," key: {"," value: ''"," }"," };",""," Y.extend(B, Y.Base, {"," api: 'http:/'+'/api.bit.ly/',"," initializer: function() {"," if (!this.get('key') || !this.get('username')) {"," Y.error('You must give a username and an API key. If you do not have an apiKey, sign up for a bitly account and go to your Account page to get your apiKey. (http:/'+'/bit.ly/)');"," }"," },"," destructor: function() {"," },"," _buildURL: function(path, param) {"," return this.api + path + '?version=2.0.1&login=' + this.get('username') + '&apiKey=' + this.get('key') + '&' + param;"," },"," _handleAPI: function(name, url, cb) {",""," var stamp = Y.guid().replace(/-/g,'_');",""," YUI[stamp] = Y.bind(function(e) {"," if (e.results) {"," if (name === 'stats') {"," this.fire(name, e.results);"," if (cb) {"," cb = Y.bind(cb, this);"," cb(e.results);"," }"," } else {"," Y.each(e.results, function(v) {"," this.fire(name, v);"," if (cb) {"," cb = Y.bind(cb, this);"," cb(v);"," }"," }, this);"," }"," }"," delete YUI[stamp];"," }, this);",""," Y.Get.script(url + '&callback=YUI.' + stamp);"," },"," shorten: function(url, cb) {"," var api = this._buildURL('shorten', 'longUrl=' + encodeURIComponent(url));"," this._handleAPI('shorten', api, cb);"," },"," expand: function(p, cb) {"," var path = ((p.url) ? 'shortUrl=' + encodeURIComponent(p.url) : 'hash=' + p.hash),"," api = this._buildURL('expand', path);",""," this._handleAPI('expand', api, cb);",""," },"," expandByURL: function(v, cb) {"," return this.expand({ url: v }, cb);"," },"," expandByHash: function(v, cb) {"," return this.expand({ hash: v }, cb);"," },"," info: function(p, cb) {"," var path = ((p.url) ? 'shortUrl=' + encodeURIComponent(p.url) : 'hash=' + p.hash),"," api = this._buildURL('info', path);",""," this._handleAPI('info', api, cb);",""," },"," infoByURL: function(v, cb) {"," return this.info({ url: v }, cb);"," },"," infoByHash: function(v, cb) {"," return this.info({ hash: v }, cb);"," },"," stats: function(p, cb) {"," var path = ((p.url) ? 'shortUrl=' + encodeURIComponent(p.url) : 'hash=' + p.hash),"," api = this._buildURL('stats', path);",""," this._handleAPI('stats', api, cb);",""," },"," statsByURL: function(v, cb) {"," return this.stats({ url: v }, cb);"," },"," statsByHash: function(v, cb) {"," return this.stats({ hash: v }, cb);"," }"," });",""," Y.bitly = B;","","","}, '@VERSION@', {\"requires\": [\"base\", \"get\"], \"supersedes\": [], \"optional\": [], \"skinnable\": false});"];
_yuitest_coverage["build/gallery-bitly/gallery-bitly.js"].lines = {"1":0,"5":0,"6":0,"9":0,"11":0,"20":0,"23":0,"24":0,"30":0,"34":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"45":0,"46":0,"47":0,"48":0,"49":0,"54":0,"57":0,"60":0,"61":0,"64":0,"67":0,"71":0,"74":0,"77":0,"80":0,"84":0,"87":0,"90":0,"93":0,"97":0,"100":0,"104":0};
_yuitest_coverage["build/gallery-bitly/gallery-bitly.js"].functions = {"B:5":0,"initializer:22":0,"_buildURL:29":0,"(anonymous 3):45":0,"(anonymous 2):36":0,"_handleAPI:32":0,"shorten:59":0,"expand:63":0,"expandByURL:70":0,"expandByHash:73":0,"info:76":0,"infoByURL:83":0,"infoByHash:86":0,"stats:89":0,"statsByURL:96":0,"statsByHash:99":0,"(anonymous 1):1":0};
_yuitest_coverage["build/gallery-bitly/gallery-bitly.js"].coveredLines = 39;
@@ -34,14 +34,14 @@ _yuitest_coverage["build/gallery-bitly/gallery-bitly.js"].coveredFunctions = 17;
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 1);
YUI.add('gallery-bitly', function (Y, NAME) {
-
+/*jshint maxlen: 200 */
_yuitest_coverfunc("build/gallery-bitly/gallery-bitly.js", "(anonymous 1)", 1);
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 5);
var B = function(config) {
_yuitest_coverfunc("build/gallery-bitly/gallery-bitly.js", "B", 5);
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 6);
-B.superclass.constructor.call(this, config);
+B.superclass.constructor.call(this, config);
};
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 9);
@@ -87,7 +87,7 @@ YUI[stamp] = Y.bind(function(e) {
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 37);
if (e.results) {
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 38);
-if (name == 'stats') {
+if (name === 'stats') {
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 39);
this.fire(name, e.results);
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 40);
@@ -116,7 +116,7 @@ cb(v);
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 54);
delete YUI[stamp];
}, this);
-
+
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 57);
Y.Get.script(url + '&callback=YUI.' + stamp);
},
@@ -135,7 +135,7 @@ var path = ((p.url) ? 'shortUrl=' + encodeURIComponent(p.url) : 'hash=' + p.hash
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 67);
this._handleAPI('expand', api, cb);
-
+
},
expandByURL: function(v, cb) {
_yuitest_coverfunc("build/gallery-bitly/gallery-bitly.js", "expandByURL", 70);
@@ -155,7 +155,7 @@ var path = ((p.url) ? 'shortUrl=' + encodeURIComponent(p.url) : 'hash=' + p.hash
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 80);
this._handleAPI('info', api, cb);
-
+
},
infoByURL: function(v, cb) {
_yuitest_coverfunc("build/gallery-bitly/gallery-bitly.js", "infoByURL", 83);
@@ -175,7 +175,7 @@ var path = ((p.url) ? 'shortUrl=' + encodeURIComponent(p.url) : 'hash=' + p.hash
_yuitest_coverline("build/gallery-bitly/gallery-bitly.js", 93);
this._handleAPI('stats', api, cb);
-
+
},
statsByURL: function(v, cb) {
_yuitest_coverfunc("build/gallery-bitly/gallery-bitly.js", "statsByURL", 96);
View
14 build/gallery-bitly/gallery-bitly-debug.js
@@ -1,9 +1,9 @@
YUI.add('gallery-bitly', function (Y, NAME) {
-
+/*jshint maxlen: 200 */
var B = function(config) {
- B.superclass.constructor.call(this, config);
+ B.superclass.constructor.call(this, config);
};
B.NAME = 'bitly';
@@ -36,7 +36,7 @@ YUI.add('gallery-bitly', function (Y, NAME) {
YUI[stamp] = Y.bind(function(e) {
if (e.results) {
- if (name == 'stats') {
+ if (name === 'stats') {
this.fire(name, e.results);
if (cb) {
cb = Y.bind(cb, this);
@@ -54,7 +54,7 @@ YUI.add('gallery-bitly', function (Y, NAME) {
}
delete YUI[stamp];
}, this);
-
+
Y.Get.script(url + '&callback=YUI.' + stamp);
},
shorten: function(url, cb) {
@@ -66,7 +66,7 @@ YUI.add('gallery-bitly', function (Y, NAME) {
api = this._buildURL('expand', path);
this._handleAPI('expand', api, cb);
-
+
},
expandByURL: function(v, cb) {
return this.expand({ url: v }, cb);
@@ -79,7 +79,7 @@ YUI.add('gallery-bitly', function (Y, NAME) {
api = this._buildURL('info', path);
this._handleAPI('info', api, cb);
-
+
},
infoByURL: function(v, cb) {
return this.info({ url: v }, cb);
@@ -92,7 +92,7 @@ YUI.add('gallery-bitly', function (Y, NAME) {
api = this._buildURL('stats', path);
this._handleAPI('stats', api, cb);
-
+
},
statsByURL: function(v, cb) {
return this.stats({ url: v }, cb);
View
2  build/gallery-bitly/gallery-bitly-min.js
@@ -1 +1 @@
-YUI.add("gallery-bitly",function(e,t){var n=function(e){n.superclass.constructor.call(this,e)};n.NAME="bitly",n.ATTRS={username:{value:""},key:{value:""}},e.extend(n,e.Base,{api:"http://api.bit.ly/",initializer:function(){(!this.get("key")||!this.get("username"))&&e.error("You must give a username and an API key. If you do not have an apiKey, sign up for a bitly account and go to your Account page to get your apiKey. (http://bit.ly/)")},destructor:function(){},_buildURL:function(e,t){return this.api+e+"?version=2.0.1&login="+this.get("username")+"&apiKey="+this.get("key")+"&"+t},_handleAPI:function(t,n,r){var i=e.guid().replace(/-/g,"_");YUI[i]=e.bind(function(n){n.results&&(t=="stats"?(this.fire(t,n.results),r&&(r=e.bind(r,this),r(n.results))):e.each(n.results,function(n){this.fire(t,n),r&&(r=e.bind(r,this),r(n))},this)),delete YUI[i]},this),e.Get.script(n+"&callback=YUI."+i)},shorten:function(e,t){var n=this._buildURL("shorten","longUrl="+encodeURIComponent(e));this._handleAPI("shorten",n,t)},expand:function(e,t){var n=e.url?"shortUrl="+encodeURIComponent(e.url):"hash="+e.hash,r=this._buildURL("expand",n);this._handleAPI("expand",r,t)},expandByURL:function(e,t){return this.expand({url:e},t)},expandByHash:function(e,t){return this.expand({hash:e},t)},info:function(e,t){var n=e.url?"shortUrl="+encodeURIComponent(e.url):"hash="+e.hash,r=this._buildURL("info",n);this._handleAPI("info",r,t)},infoByURL:function(e,t){return this.info({url:e},t)},infoByHash:function(e,t){return this.info({hash:e},t)},stats:function(e,t){var n=e.url?"shortUrl="+encodeURIComponent(e.url):"hash="+e.hash,r=this._buildURL("stats",n);this._handleAPI("stats",r,t)},statsByURL:function(e,t){return this.stats({url:e},t)},statsByHash:function(e,t){return this.stats({hash:e},t)}}),e.bitly=n},"@VERSION@",{requires:["base","get"],supersedes:[],optional:[],skinnable:!1});
+YUI.add("gallery-bitly",function(e,t){var n=function(e){n.superclass.constructor.call(this,e)};n.NAME="bitly",n.ATTRS={username:{value:""},key:{value:""}},e.extend(n,e.Base,{api:"http://api.bit.ly/",initializer:function(){(!this.get("key")||!this.get("username"))&&e.error("You must give a username and an API key. If you do not have an apiKey, sign up for a bitly account and go to your Account page to get your apiKey. (http://bit.ly/)")},destructor:function(){},_buildURL:function(e,t){return this.api+e+"?version=2.0.1&login="+this.get("username")+"&apiKey="+this.get("key")+"&"+t},_handleAPI:function(t,n,r){var i=e.guid().replace(/-/g,"_");YUI[i]=e.bind(function(n){n.results&&(t==="stats"?(this.fire(t,n.results),r&&(r=e.bind(r,this),r(n.results))):e.each(n.results,function(n){this.fire(t,n),r&&(r=e.bind(r,this),r(n))},this)),delete YUI[i]},this),e.Get.script(n+"&callback=YUI."+i)},shorten:function(e,t){var n=this._buildURL("shorten","longUrl="+encodeURIComponent(e));this._handleAPI("shorten",n,t)},expand:function(e,t){var n=e.url?"shortUrl="+encodeURIComponent(e.url):"hash="+e.hash,r=this._buildURL("expand",n);this._handleAPI("expand",r,t)},expandByURL:function(e,t){return this.expand({url:e},t)},expandByHash:function(e,t){return this.expand({hash:e},t)},info:function(e,t){var n=e.url?"shortUrl="+encodeURIComponent(e.url):"hash="+e.hash,r=this._buildURL("info",n);this._handleAPI("info",r,t)},infoByURL:function(e,t){return this.info({url:e},t)},infoByHash:function(e,t){return this.info({hash:e},t)},stats:function(e,t){var n=e.url?"shortUrl="+encodeURIComponent(e.url):"hash="+e.hash,r=this._buildURL("stats",n);this._handleAPI("stats",r,t)},statsByURL:function(e,t){return this.stats({url:e},t)},statsByHash:function(e,t){return this.stats({hash:e},t)}}),e.bitly=n},"@VERSION@",{requires:["base","get"],supersedes:[],optional:[],skinnable:!1});
View
14 build/gallery-bitly/gallery-bitly.js
@@ -1,9 +1,9 @@
YUI.add('gallery-bitly', function (Y, NAME) {
-
+/*jshint maxlen: 200 */
var B = function(config) {
- B.superclass.constructor.call(this, config);
+ B.superclass.constructor.call(this, config);
};
B.NAME = 'bitly';
@@ -35,7 +35,7 @@ YUI.add('gallery-bitly', function (Y, NAME) {
YUI[stamp] = Y.bind(function(e) {
if (e.results) {
- if (name == 'stats') {
+ if (name === 'stats') {
this.fire(name, e.results);
if (cb) {
cb = Y.bind(cb, this);
@@ -53,7 +53,7 @@ YUI.add('gallery-bitly', function (Y, NAME) {
}
delete YUI[stamp];
}, this);
-
+
Y.Get.script(url + '&callback=YUI.' + stamp);
},
shorten: function(url, cb) {
@@ -65,7 +65,7 @@ YUI.add('gallery-bitly', function (Y, NAME) {
api = this._buildURL('expand', path);
this._handleAPI('expand', api, cb);
-
+
},
expandByURL: function(v, cb) {
return this.expand({ url: v }, cb);
@@ -78,7 +78,7 @@ YUI.add('gallery-bitly', function (Y, NAME) {
api = this._buildURL('info', path);
this._handleAPI('info', api, cb);
-
+
},
infoByURL: function(v, cb) {
return this.info({ url: v }, cb);
@@ -91,7 +91,7 @@ YUI.add('gallery-bitly', function (Y, NAME) {
api = this._buildURL('stats', path);
this._handleAPI('stats', api, cb);
-
+
},
statsByURL: function(v, cb) {
return this.stats({ url: v }, cb);
View
0  src/gallery-bitly/meta/.keep → src/bitly/assets/.keep
File renamed without changes
View
0  src/gallery-bitly/build.json → src/bitly/build.json
File renamed without changes
View
0  src/gallery-bitly/build.properties → src/bitly/build.properties
File renamed without changes
View
0  src/gallery-bitly/build.xml → src/bitly/build.xml
File renamed without changes
View
0  src/gallery-bitly/build_tmp/gallery-bitly-debug.js → src/bitly/build_tmp/gallery-bitly-debug.js
File renamed without changes
View
0  src/gallery-bitly/build_tmp/gallery-bitly-min.js → src/bitly/build_tmp/gallery-bitly-min.js
File renamed without changes
View
0  src/gallery-bitly/build_tmp/gallery-bitly.js → src/bitly/build_tmp/gallery-bitly.js
File renamed without changes
View
0  src/gallery-bitly/css/.keep → src/bitly/css/.keep
File renamed without changes
View
0  src/gallery-bitly/docs/component.json → src/bitly/docs/component.json
File renamed without changes
View
0  src/gallery-bitly/docs/index.mustache → src/bitly/docs/index.mustache
File renamed without changes
View
24 src/gallery-bitly/js/bitly.js → src/bitly/js/bitly.js
@@ -1,7 +1,19 @@
+/*jshint maxlen: 200 */
+/**
+Bitly API Access
+@module gallery-bitly
+*/
+
+/**
+Bitly API Access
+@class bitly
+@constructor
+@param {Object} config Config object
+*/
var B = function(config) {
- B.superclass.constructor.call(this, config);
+ B.superclass.constructor.call(this, config);
};
B.NAME = 'bitly';
@@ -34,7 +46,7 @@
YUI[stamp] = Y.bind(function(e) {
if (e.results) {
- if (name == 'stats') {
+ if (name === 'stats') {
this.fire(name, e.results);
if (cb) {
cb = Y.bind(cb, this);
@@ -52,7 +64,7 @@
}
delete YUI[stamp];
}, this);
-
+
Y.Get.script(url + '&callback=YUI.' + stamp);
},
shorten: function(url, cb) {
@@ -64,7 +76,7 @@
api = this._buildURL('expand', path);
this._handleAPI('expand', api, cb);
-
+
},
expandByURL: function(v, cb) {
return this.expand({ url: v }, cb);
@@ -77,7 +89,7 @@
api = this._buildURL('info', path);
this._handleAPI('info', api, cb);
-
+
},
infoByURL: function(v, cb) {
return this.info({ url: v }, cb);
@@ -90,7 +102,7 @@
api = this._buildURL('stats', path);
this._handleAPI('stats', api, cb);
-
+
},
statsByURL: function(v, cb) {
return this.stats({ url: v }, cb);
View
0  src/gallery-bitly/assets/.keep → src/bitly/meta/.keep
File renamed without changes
View
0  src/gallery-bitly/meta/gallery-bitly.json → src/bitly/meta/gallery-bitly.json
File renamed without changes
View
6 src/gallery-bitly/tests/unit/index.html → src/bitly/tests/unit/index.html
@@ -10,10 +10,10 @@
<script>
YUI({
- coverage: ['bitly'],
+ coverage: ['gallery-bitly'],
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw'
-}).use('test-console', 'test', 'module-tests', function(Y) {
-
+}).use('gallery-bitly', 'test-console', 'test', 'module-tests', function(Y) {
+
(new Y.Test.Console()).render('#logger');
Y.Test.Runner.setName('gallery-bitly');
View
28 src/bitly/tests/unit/js/tests.js
@@ -0,0 +1,28 @@
+YUI.add('module-tests', function(Y) {
+
+ var suite = new Y.Test.Suite('gallery-bitly'),
+ Assert = Y.Test.Assert;
+
+ suite.add(new Y.Test.Case({
+ name: 'Gallery Bitly',
+ 'should be a class': function() {
+ Assert.isFunction(Y.bitly);
+ },
+ 'should create an object': function() {
+ var b = new Y.bitly({
+ username: 'test',
+ key: 'this-is-the-key'
+ });
+ Assert.isObject(b);
+ this.b = b;
+ },
+ 'should build url': function() {
+ var url = this.b._buildURL('expand', 'extra=ok');
+ Assert.areEqual(url, 'http://api.bit.ly/expand?version=2.0.1&login=test&apiKey=this-is-the-key&extra=ok');
+ }
+ }));
+
+ Y.Test.Runner.add(suite);
+
+
+},'', { requires: [ 'test' ] });
View
15 src/gallery-bitly/tests/unit/js/tests.js
@@ -1,15 +0,0 @@
-YUI.add('module-tests', function(Y) {
-
- var suite = new Y.Test.Suite('gallery-bitly');
-
- suite.add(new Y.Test.Case({
- name: 'Automated Tests',
- 'test is empty': function() {
- Y.Assert.fail('No Tests Provided For This Module');
- }
- }));
-
- Y.Test.Runner.add(suite);
-
-
-},'', { requires: [ 'test' ] });
Please sign in to comment.
Something went wrong with that request. Please try again.