]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#519] removePlugin() calling teardown before removal of plugin
authorScottDowne <sdowne@learn.senecac.on.ca>
Mon, 13 Jun 2011 19:23:09 +0000 (15:23 -0400)
committerScottDowne <sdowne@learn.senecac.on.ca>
Mon, 13 Jun 2011 19:23:09 +0000 (15:23 -0400)
popcorn.js
test/popcorn.unit.js

index d5adf76528ff9b1ab18f0472db07bf9f8410db5e..ccb26a7f9d91d5504a3644d11efdb511decd76eb 100644 (file)
       if ( ( byStart[ idx ] && byStart[ idx ]._natives && byStart[ idx ]._natives.type === name ) &&
                 ( byEnd[ idx ] && byEnd[ idx ]._natives && byEnd[ idx ]._natives.type === name ) ) {
 
+        byStart[ idx ]._natives._teardown && byStart[ idx ]._natives._teardown.call( obj, byStart[ idx ] );
+
         byStart.splice( idx, 1 );
         byEnd.splice( idx, 1 );
 
index 099a1986368738518df6ac926ee4dec18cfdefe1..df3ab3192d844a15ce32746b7886e4695bf0633a 100644 (file)
@@ -1494,7 +1494,7 @@ test("Remove Plugin", function () {
       p2 = Popcorn("#video"),
       rlen = Popcorn.registry.length,
       count = 0,
-      expects = 21,
+      expects = 23,
       interval;
 
   function plus() {
@@ -1522,17 +1522,23 @@ test("Remove Plugin", function () {
     },
     end: function () {
 
+    },
+    _teardown: function( options ) {
+      ok( true, "teardown called on " + options.order + " plugin via removePlugin()" );
+      plus();
     }
   });
 
   p.removeme({
     start: 2,
-    end: 3
+    end: 3,
+    order: "first"
   });
 
   p2.removeme({
     start: 2,
-    end: 3
+    end: 3,
+    order: "second"
   });
 
   equals( Popcorn.registry.length, 1, "Popcorn.registry.length is 1");