]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#336] tweak the comments in the test, address Scott's other review comment, and...
authorDaniel Brooks <db48x@db48x.net>
Wed, 23 Feb 2011 21:10:46 +0000 (15:10 -0600)
committerDaniel Brooks <db48x@db48x.net>
Wed, 23 Feb 2011 21:10:46 +0000 (15:10 -0600)
popcorn.js
test/popcorn.unit.js

index 7461da7712530864eec08e0fff788a523a3341c7..083f36b72d40d7e1e23d3c7676b64d9a60394805 100644 (file)
         plugin = {},
         setup;
 
-    function pluginFn ( setup, options ) {
+    var pluginFn = function ( setup, options ) {
 
       if ( !options ) {
         return this;
       Popcorn.manifest[ name ] = manifest || definition.manifest;
     }
 
+    var isfn = typeof definition === "function";
     //  Assign new named definition
     plugin[ name ] = function( options ) {
-      return pluginFn.call( this, typeof definition === "function" ? 
-                                          definition.call( this, options ) :
-                                            definition, options );
+      return pluginFn.call( this,
+                            isfn ? definition.call( this, options )
+                                 : definition, options );
     };
 
     //  Extend Popcorn.p with new named definition
index 21b74bf11e79ef7de321a5c4e72037f01bb2c585..4595a5af0d57cff1225f211559d1a87cbffeaaee 100755 (executable)
@@ -753,12 +753,12 @@ test("Plugin Factory", function () {
         options.endCount = 0;
       },
       start: function ( event, options ) {
-        // test is run four times. Two closure tracks, called twice each
+        // called once for each instance; the test will fail if startCount is not actually unique per instance
         equals( startCount++, options.startCount++, options.nick + " has correct start counts" );
         plus();
       },
       end: function ( event, options ) {
-        // test is run four times. Two closure tracks, called twice each
+        // likewise for endCount
         equals( endCount++, options.endCount++, options.nick + " has correct end counts" );
         plus();