]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#238] Add plugin manifest to Popcorn.registry entries
authorrwldrn <waldron.rick@gmail.com>
Mon, 20 Dec 2010 23:28:55 +0000 (18:28 -0500)
committerrwldrn <waldron.rick@gmail.com>
Mon, 20 Dec 2010 23:30:59 +0000 (18:30 -0500)
popcorn.js
test/popcorn.unit.js

index 03b809642ffe2e191f01b891b4b3ab4c6a0fa42c..d2206d5d620de086ee2a9b412d1014e392129874 100644 (file)
   
   });
   
-  
+  //  Plugin manifests
+  Popcorn.manifest = {};
   //  Plugins are registered 
   Popcorn.registry = [];
   //  An interface for extending Popcorn 
     Popcorn.registry.push(plugin);
     
     
+    if ( !!( "manifest" in setup ) ) {
+      
+      //  Augment the manifest object
+      Popcorn.manifest[ name ] = setup.manifest;
+    }    
+    
     return plugin;
   };
   
index 6ea97f7e0bf5313137fe0ab5023a01826c6756ba..280a53859c309abb7cb98125d6887cfda70c53f4 100644 (file)
@@ -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 () {