test media-tag, and fix the bug the tests exposed
This commit is contained in:
parent
bc57f8c274
commit
eac7d38655
@ -9,7 +9,8 @@ define([
|
|||||||
'/common/common-thumbnail.js',
|
'/common/common-thumbnail.js',
|
||||||
'/common/wire.js',
|
'/common/wire.js',
|
||||||
'/common/flat-dom.js',
|
'/common/flat-dom.js',
|
||||||
], function ($, Hyperjson, Sortify, Drive, Test, Hash, Util, Thumb, Wire, Flat) {
|
'/common/media-tag.js',
|
||||||
|
], function ($, Hyperjson, Sortify, Drive, Test, Hash, Util, Thumb, Wire, Flat, MediaTag) {
|
||||||
window.Hyperjson = Hyperjson;
|
window.Hyperjson = Hyperjson;
|
||||||
window.Sortify = Sortify;
|
window.Sortify = Sortify;
|
||||||
|
|
||||||
@ -295,6 +296,26 @@ define([
|
|||||||
!secret.hashData.present);
|
!secret.hashData.present);
|
||||||
}, "test support for ugly tracking query paramaters in url");
|
}, "test support for ugly tracking query paramaters in url");
|
||||||
|
|
||||||
|
assert(function (cb) {
|
||||||
|
try {
|
||||||
|
MediaTag(void 0).on('progress').on('decryption');
|
||||||
|
return void cb(true);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
return void cb(false);
|
||||||
|
}
|
||||||
|
}, 'check that MediaTag does the right thing when passed no value');
|
||||||
|
|
||||||
|
assert(function (cb) {
|
||||||
|
try {
|
||||||
|
MediaTag(document.createElement('div')).on('progress').on('decryption');
|
||||||
|
return void cb(true);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
return void cb(false);
|
||||||
|
}
|
||||||
|
}, 'check that MediaTag does the right thing when passed no value');
|
||||||
|
|
||||||
assert(function (cb) {
|
assert(function (cb) {
|
||||||
// TODO
|
// TODO
|
||||||
return cb(true);
|
return cb(true);
|
||||||
|
|||||||
@ -326,7 +326,7 @@
|
|||||||
if (typeof(el) === "object" && el.jQuery) { el = el[0]; }
|
if (typeof(el) === "object" && el.jQuery) { el = el[0]; }
|
||||||
|
|
||||||
// Abort smoothly if the element is not a media-tag
|
// Abort smoothly if the element is not a media-tag
|
||||||
if (el.nodeName !== "MEDIA-TAG") {
|
if (!el || el.nodeName !== "MEDIA-TAG") {
|
||||||
console.error("Not a media-tag!");
|
console.error("Not a media-tag!");
|
||||||
return {
|
return {
|
||||||
on: function () { return this; }
|
on: function () { return this; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user