From: ScottDowne Date: Thu, 9 Jun 2011 01:29:52 +0000 (-0400) Subject: [#562] fixed teardown bug in wordriver X-Git-Tag: v0.7^2~40^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=6a24a9b04ecc4c9cbe7f9a6088dfce6e0fa21bbf;p=popcorn-js.git [#562] fixed teardown bug in wordriver --- diff --git a/plugins/wordriver/popcorn.wordriver.js b/plugins/wordriver/popcorn.wordriver.js index 2fe6359..fba2c41 100644 --- a/plugins/wordriver/popcorn.wordriver.js +++ b/plugins/wordriver/popcorn.wordriver.js @@ -100,7 +100,7 @@ _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 ] && diff --git a/plugins/wordriver/popcorn.wordriver.unit.js b/plugins/wordriver/popcorn.wordriver.unit.js index 6dcc4b2..1cc8e90 100644 --- a/plugins/wordriver/popcorn.wordriver.unit.js +++ b/plugins/wordriver/popcorn.wordriver.unit.js @@ -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(); });