From 6a24a9b04ecc4c9cbe7f9a6088dfce6e0fa21bbf Mon Sep 17 00:00:00 2001 From: ScottDowne Date: Wed, 8 Jun 2011 21:29:52 -0400 Subject: [PATCH] [#562] fixed teardown bug in wordriver --- plugins/wordriver/popcorn.wordriver.js | 2 +- plugins/wordriver/popcorn.wordriver.unit.js | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) 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(); }); -- 2.43.0