From: rwldrn Date: Mon, 20 Dec 2010 23:28:55 +0000 (-0500) Subject: [#238] Add plugin manifest to Popcorn.registry entries X-Git-Tag: v0.2~34^2^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=08c8c80b28ced;p=popcorn-js.git [#238] Add plugin manifest to Popcorn.registry entries --- diff --git a/popcorn.js b/popcorn.js index 03b8096..d2206d5 100644 --- a/popcorn.js +++ b/popcorn.js @@ -554,7 +554,8 @@ }); - + // Plugin manifests + Popcorn.manifest = {}; // Plugins are registered Popcorn.registry = []; // An interface for extending Popcorn @@ -659,6 +660,12 @@ Popcorn.registry.push(plugin); + if ( !!( "manifest" in setup ) ) { + + // Augment the manifest object + Popcorn.manifest[ name ] = setup.manifest; + } + return plugin; }; diff --git a/test/popcorn.unit.js b/test/popcorn.unit.js index 6ea97f7..280a538 100644 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js @@ -402,6 +402,45 @@ test("UI/Mouse", function () { }); module("Popcorn Plugin") +test("Manifest", function () { + + Popcorn.plugin( "footnote" , (function(){ + + return { + manifest: { + about:{ + name: "Popcorn Manifest Plugin", + version: "0.0", + author: "Rick Waldron", + website: "" + }, + options: { + start : { elem:'input', type:'text', label:'In' }, + end : { elem:'input', type:'text', label:'Out' }, + text : { elem:'input', type:'text', label:'Manifest Text' }, + target : 'text-container' + } + }, + start: function(event, options){ + }, + + end: function(event, options){ + + } + + }; + + })()); + + + expect(1); + + equal( Popcorn.sizeOf( Popcorn.manifest ), 1, "One manifest stored" ); + + // add more tests + + Popcorn("#video").removePlugin("footnote"); +}); test("Update Timer", function () {