]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#562] fixed teardown bug in wordriver
authorScottDowne <sdowne@learn.senecac.on.ca>
Thu, 9 Jun 2011 01:29:52 +0000 (21:29 -0400)
committerScottDowne <sdowne@learn.senecac.on.ca>
Thu, 9 Jun 2011 01:29:52 +0000 (21:29 -0400)
plugins/wordriver/popcorn.wordriver.js
plugins/wordriver/popcorn.wordriver.unit.js

index 2fe6359c0d3613094201f83de8d4712357ca28c5..fba2c41d3751766fc3dcc6b83998df5c03f91bfa 100644 (file)
       _teardown: function( options ) {
 
         // removes word span from generated container
-        options._container.removeChild( options.word );
+        options.word.parentNode && options._container.removeChild( options.word );
 
         // if no more word spans exist in container, remove container
         container[ options.target ] &&
index 6dcc4b2858943abd5fd829a113a320b4482abbbd..1cc8e90f96d65274bf2d1f4750b1e4550b633a05 100644 (file)
@@ -40,11 +40,19 @@ test( "Popcorn wordriver Plugin", function () {
                text: "world",
                target: "wordriverdiv",
                color: "blue"
-  })
-  .volume(0);
+  });
 
   secondTrack = popped.getLastTrackEventId();
 
+  popped.wordriver({
+               start: 20, // seconds
+               end: 24, // seconds
+               text: "nothing here",
+               target: "wordriverdiv",
+               color: "green"
+  })
+  .volume(0);
+
   popped.exec( 0, function() {
     equals( wordriverdiv.children[0].childElementCount, 1, "wordriverdiv now has one inner element" );
     plus();
@@ -82,7 +90,7 @@ test( "Popcorn wordriver Plugin", function () {
     plus();
 
     popped.pause().removeTrackEvent( secondTrack );
-    equals( wordriverdiv.childElementCount, 0, "wordriverdiv now has no inner element" );
+    equals( wordriverdiv.childElementCount, 0, "wordriverdiv now has no inner element, even though one still exists, but was never called" );
     plus();
   });