From: Anna Sobiepanek Date: Sun, 5 Dec 2010 18:46:33 +0000 (-0500) Subject: Cleaning up directory X-Git-Tag: v0.2~63 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=b1be7dd79c2f47e613f67c82a6a9232b29bee7e8;p=popcorn-js.git Cleaning up directory --- diff --git a/test/popcorn-api-draft-unit-setup.js b/test/popcorn-api-draft-unit-setup.js deleted file mode 100644 index 5999b04..0000000 --- a/test/popcorn-api-draft-unit-setup.js +++ /dev/null @@ -1,37 +0,0 @@ - -(function (global) { - - // Store the number of global properties that exist prior to Popcorn API definition - - var Setup = { - globalSize: 0 - }; - - Setup.getGlobalSize = function() { - - var size = 0; - - for( var p in window ) { - if ( p !== "_firebug" ) { - size++; - } - } - - // account for self - size++; - - // Store the number of global properties internally - if ( !Setup.globalSize ) { - Setup.globalSize = size; - } - - return size; - }; - - - global.Setup = Setup; - -})(window); - - -Setup.getGlobalSize(); \ No newline at end of file diff --git a/test/popcorn-api-draft-unit.js b/test/popcorn-api-draft-unit.js deleted file mode 100644 index d13c5ac..0000000 --- a/test/popcorn-api-draft-unit.js +++ /dev/null @@ -1,332 +0,0 @@ -test("Popcorn API", function () { - - var expects = 3, - count = 0; - - expect(expects); - - function plus(){ if ( ++count == expects ) start(); } - - stop(); - - - try { - - ok( Popcorn, "Popcorn exists"); - plus(); - - } catch (e) {}; - - - try { - - ok( typeof Popcorn === "function", "Popcorn is a function"); - plus(); - - } catch (e) {}; - - try { - - equals( Setup.getGlobalSize(), Setup.globalSize + 1 , "Popcorn API creates only 1 global reference"); - plus(); - - } catch (e) {}; - - -}); - -test("Popcorn Utility", function () { - - equals( typeof Popcorn.forEach, "function" , "Popcorn.forEach is a provided utility function"); - equals( typeof Popcorn.extend, "function" , "Popcorn.extend is a provided utility function"); - -}); - - -test("Popcorn Object", function () { - - - var popped = Popcorn("#video"), - methods = "load play pause currentTime mute volume"; - - //console.log(popped); - - popped.play(); - - methods.split(/\s+/g).forEach(function (k,v) { - - ok( k in popped, "instance has method: " + k ); - - }); - - ok( "video" in popped, "instance has `video` property" ); - ok( Object.prototype.toString.call(popped.video) === "[object HTMLVideoElement]", "video property is a HTMLVideoElement" ); - - ok( "data" in popped, "instance has `data` property" ); - ok( Object.prototype.toString.call(popped.data) === "[object Object]", "data property is an object" ); - - ok( "tracks" in popped.data, "instance has `tracks` property" ); - ok( Object.prototype.toString.call(popped.data.tracks) === "[object Array]", "tracks property is an array" ) - -}); - - -test("Popcorn Events Stored By Type", function () { - - QUnit.reset(); - - expect(6) - - var p = Popcorn("#video"), - count = 0, - fired = 0, - wants = 4 - ; - - function plus(){ - - if ( ++count == 4 ) { - - equals( fired, wants, "Number of callbacks fired from 1 handler" ); - - p.unlisten("play"); - - ok( !p.data.events["play"], "play handlers removed" ); - - start(); - } - } - - stop(); - - - p.listen("play", function () { - fired++; - - ok(true, "Play fired " + fired); - plus(); - }); - - p.listen("play", function () { - fired++; - - ok(true, "Play fired " + fired); - plus(); - }); - - p.listen("play", function () { - fired++; - - ok(true, "Play fired " + fired); - plus(); - }); - - p.listen("play", function () { - fired++; - - ok(true, "Play fired " + fired); - plus(); - }); - - p.trigger("play"); - - p.unlisten("play"); - -}); - - -test("Popcorn Events Simulated", function () { - - QUnit.reset(); - - var p = Popcorn("#video"), - completed = [], - eventtest = "loadstart progress suspend emptied stalled play pause " + - "loadedmetadata loadeddata waiting playing canplay canplaythrough " + - "seeking seeked timeupdate ended ratechange durationchange volumechange", - events = eventtest.split(/\s+/g); - - - var expects = events.length, - count = 0; - - expect(expects); - - function plus(){ - if ( ++count == expects ) start(); - } - - stop(); - - - events.forEach(function ( name ) { - p.listen( name, function (event) { - - if ( completed.indexOf(name) === -1 ) { - ok(true, name + " fired"); - plus(); - - completed.push(name); - } - - - }); - }); - - events.forEach(function ( name ) { - p.trigger( name ); - }); - - -}); - - -test("Popcorn Events Real", function () { - - QUnit.reset(); - - var p = Popcorn("#video"), - completed = [], - eventtest = "loadstart progress suspend emptied stalled play pause " + - "loadedmetadata loadeddata waiting playing canplay canplaythrough " + - "seeking seeked timeupdate ended ratechange durationchange volumechange", - events = eventtest.split(/\s+/g); - - - var expects = 11, - count = 0; - - //expect(expects); - // not in full use - function plus(){ - if ( ++count == expects ) start(); - } - - stop(); - - - events.forEach(function ( name ) { - p.listen( name, function (event) { - - if ( completed.indexOf(name) === -1 ) { - ok(true, name + " fired"); - plus(); - - completed.push(name); - } - - - }); - }); - - - - p.pause(); - - p.mute(true); - - p.play(); - - p.volume(0.9); - - p.currentTime(49); - - - -}); - -test("Popcorn Plugin", function () { - - QUnit.reset(); - - // needs expectation - - var popped = Popcorn("#video"), - methods = "load play pause currentTime mute volume"; - - - stop(); - - - Popcorn.plugin("subtitles", function () { - - var self = this; - - // These ensure that a popcorn instance is the value of `this` inside a plugin definition - - methods.split(/\s+/g).forEach(function (k,v) { - ok( k in self, "instance has method: " + k ); - }); - - ok( "video" in this, "instance has `video` property" ); - ok( Object.prototype.toString.call(popped.video) === "[object HTMLVideoElement]", "video property is a HTMLVideoElement" ); - - ok( "data" in this, "instance has `data` property" ); - ok( Object.prototype.toString.call(popped.data) === "[object Object]", "data property is an object" ); - - ok( "tracks" in this.data, "instance has `tracks` property" ); - ok( Object.prototype.toString.call(popped.data.tracks) === "[object Array]", "tracks property is an array" ) - }); - - - // Call plugin to test scope within - popped.subtitles(); - - - - ok( "subtitles" in popped, "subtitles plugin is now available to instance" ); - ok( Popcorn.registry.length === 1, "One item in the registry"); - - - - - - Popcorn.plugin("complicator", { - - start: function ( event ) { - - - equals( ~~this.currentTime(), 1, "~~this.currentTime() === 1"); - - var self = this; - - // These ensure that a popcorn instance is the value of `this` inside a plugin definition - - methods.split(/\s+/g).forEach(function (k,v) { - ok( k in self, "instance has method: " + k ); - }); - - ok( "video" in this, "instance has `video` property" ); - ok( Object.prototype.toString.call(popped.video) === "[object HTMLVideoElement]", "video property is a HTMLVideoElement" ); - - ok( "data" in this, "instance has `data` property" ); - ok( Object.prototype.toString.call(popped.data) === "[object Object]", "data property is an object" ); - - ok( "tracks" in this.data, "instance has `tracks` property" ); - ok( Object.prototype.toString.call(popped.data.tracks) === "[object Array]", "tracks property is an array" ) - - }, - end: function () { - - start(); - - }, - timeupdate: function () { - } - }); - - - ok( "complicator" in popped, "complicator plugin is now available to instance" ); - ok( Popcorn.registry.length === 2, "Two items in the registry"); - - - - popped.currentTime(0); - - popped.complicator({ - start: 1, - end: 2 - }); - - -}); \ No newline at end of file