From bc261dde27a68aa1021b3b50f896e7b1d7105356 Mon Sep 17 00:00:00 2001 From: rwldrn Date: Thu, 23 Dec 2010 16:35:27 -0500 Subject: [PATCH] [#239] Explicitly copy property setup.manifeset.options.target --- popcorn.js | 14 +++++++------- test/popcorn.unit.js | 26 ++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/popcorn.js b/popcorn.js index 54434cd..63714c9 100644 --- a/popcorn.js +++ b/popcorn.js @@ -213,9 +213,7 @@ Popcorn.forEach( src, function( copy ) { for ( var prop in copy ) { - if ( copy[prop] ) { - dest[prop] = copy[prop]; - } + dest[prop] = copy[prop]; } }); return dest; @@ -235,9 +233,7 @@ var size = 0; for ( var prop in obj ) { - if ( obj[prop] ) { - size++; - } + size++; } return size; @@ -664,7 +660,11 @@ // the events commence if ( "_setup" in setup && typeof setup._setup === "function" ) { - setup._setup.call( this, options ); + + setup._setup.call( this, Popcorn.extend( {}, options, { + target: setup.manifest.options.target || "" + }) + ); } diff --git a/test/popcorn.unit.js b/test/popcorn.unit.js index a468e7f..b880bb3 100644 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js @@ -417,6 +417,21 @@ test("UI/Mouse", function () { module("Popcorn Plugin") test("Manifest", function () { + + + var p = Popcorn("#video"), + expects = 2, + count = 0; + + function plus() { + if ( ++count === expects ) { + start(); + // clean up added events after tests + p.removePlugin("footnote"); + } + } + + stop( 10000 ); Popcorn.plugin( "footnote" , (function(){ return { @@ -434,6 +449,10 @@ test("Manifest", function () { target : 'text-container' } }, + _setup: function( options ) { + ok( options.target, "`options.target exists`" ); + plus(); + }, start: function(event, options){ }, @@ -446,13 +465,16 @@ test("Manifest", function () { })()); - expect(1); + expect(expects); equal( Popcorn.sizeOf( Popcorn.manifest ), 1, "One manifest stored" ); + plus(); // add more tests - Popcorn("#video").removePlugin("footnote"); + p.footnote({}); + + }); test("Update Timer", function () { -- 2.43.0