From: David Seifried Date: Wed, 14 Sep 2011 16:18:17 +0000 (-0400) Subject: Simplified unit tests and added warning being thrown by lint to its ignore list X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=3e7e6d071cbe31914692baf6988a3c16da38df88;p=popcorn-js.git Simplified unit tests and added warning being thrown by lint to its ignore list --- diff --git a/build/jslint-check.js b/build/jslint-check.js index 335efc7..6a97e4a 100644 --- a/build/jslint-check.js +++ b/build/jslint-check.js @@ -10,7 +10,8 @@ var ok = { "Expected an assignment or function call and instead saw an expression.": true, "Expected a 'break' statement before 'case'.": true, "'e' is already defined.": true, - "Don't make functions within a loop.": true + "Don't make functions within a loop.": true, + "['out'] is better written in dot notation.": true }; function check(src) diff --git a/test/popcorn.unit.js b/test/popcorn.unit.js index f3fd67a..e448b27 100644 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js @@ -2582,9 +2582,7 @@ test( "In/Out aliases", function() { var popcorn = Popcorn( "#video" ), expects = 3, count = 0, - aliasDiv = document.createElement( "div" ); - - document.body.appendChild( aliasDiv ); + counter = 0; expect( expects ); stop( 5000 ); @@ -2592,25 +2590,19 @@ test( "In/Out aliases", function() { function plus() { if ( ++count === expects ) { Popcorn.removePlugin( "aliasTester" ); - document.body.removeChild( aliasDiv ); + Popcorn.removeInstance( popcorn ); start(); } } - aliasDiv.id = "aliasDiv"; - Popcorn.plugin( "aliasTester", function() { return { start: function() { - var div = document.getElementById( "aliasDiv" ); - div.style.display = "inline"; - div.innerHTML = "Showing"; + counter++; }, end: function() { - var div = document.getElementById( "aliasDiv" ); - div.innerHTML = ""; - div.style.display = "none"; + counter++; } }; }); @@ -2622,16 +2614,16 @@ test( "In/Out aliases", function() { popcorn.currentTime( 0 ).pause(); - equals( aliasDiv.innerHTML, "", "Container is initially empty" ); + equals( counter, 0, "Container is initially empty" ); plus(); popcorn.exec( 2, function() { - equals( aliasDiv.innerHTML, "Showing", "Container is displaying 'Showing', in alias is working" ); + equals( counter, 1, "Container is displaying 'Showing', in alias is working" ); plus(); }); popcorn.exec( 4, function() { - equals( aliasDiv.innerHTML, "", "Container is displaying nothing again, out alias is working" ); + equals( counter, 2, "Container is displaying nothing again, out alias is working" ); plus(); });