return Popcorn.getTrackEvents !== undefined;
}
},
+ {
+ title: 'Popcorn.getTrackEvents(popcorn) returns correct results',
+ test: function() {
+ var results = Popcorn.getTrackEvents(popcorn);
+ for (var i in results) {
+ if (results[i].start === 1 && results[i].end === 2) {
+ return true;
+ } //if
+ } //for
+ return false;
+ }
+ },
{
title: 'Popcorn.getTrackEvents exists',
test: function() {
return popcorn['notValid'] === undefined;
}
},
+ {
+ title: 'p[validPluginName] is expected plugin',
+ test: function() {
+ return popcorn['test'] === plugin['test'];
+ }
+ },
{
title: 'Popcorn.registry must be a list',
test: function() {
}
},
{
- title: 'popcorn.getLastTrackEventId exists',
+ title: 'popcorn.getLastTrackEventId exists and works',
test: function() {
- return popcorn.data.history !== undefined && typeof(popcorn.data.history) === 'object';
+ var exists = popcorn.getLastTrackEventId !== undefined;
+ var works = popcorn.getLastTrackEventId() !== undefined;
+ return exists && works;
}
},
{
- title: 'popcorn.getTrackEvents exists',
+ title: 'popcorn.getTrackEvents exists and works',
test: function() {
- return popcorn.data.history !== undefined && typeof(popcorn.data.history) === 'object';
+ console.log(popcorn.getTrackEvents());
+ var exists = popcorn.getTrackEvents !== undefined;
+ var works = popcorn.getTrackEvents();
+ return exists && works;
}
},
{
- title: 'popcorn.removeTrackEvent exists',
+ title: 'popcorn.getTrackEvents === Popcorn.getTrackEvents(popcorn)',
test: function() {
- return popcorn.data.history !== undefined && typeof(popcorn.data.history) === 'object';
+ console.log(popcorn.getTrackEvents());
+ var exists = popcorn.getTrackEvents !== undefined;
+ var tracks1 = popcorn.getTrackEvents();
+ var tracks2 = Popcorn.getTrackEvents(popcorn);
+ var works = tracks1.length === tracks2.length && tracks1[0] === tracks2[0];
+ return exists && works;
}
},
{
- title: 'popcorn.listen exists',
+ title: 'popcorn.listen exists && works',
test: function() {
- return popcorn.data.history !== undefined && typeof(popcorn.data.history) === 'object';
+ var exists = popcorn.listen !== undefined;
+ popcorn.listen('ended', function(){});
+ for (var i in popcorn.data.events['ended']) {
+ return exists && true;
+ } //for
+ return false;
+ }
+ },
+ {
+ title: 'popcorn.removeTrackEvent exists and works',
+ test: function() {
+ var exists = popcorn.removeTrackEvent !== undefined;
+ popcorn.removeTrackEvent(popcorn.getLastTrackEventId());
+ var works = popcorn.getTrackEvents().length === 0;
+ return exists && works;
}
},
];