test("Popcorn wikipedia Plugin", function () {
var popped = Popcorn( "#video" ),
- expects = 11,
+ expects = 13,
count = 0,
theArticle = document.getElementById( "wikidiv" );
end: 3, // seconds
src: "http://en.wikipedia.org/wiki/Cape_Town",
title: "this is an article",
- target: "wikidiv"
+ target: "wikidiv",
+ numberofwords: 22
} )
.wikipedia({
start: 4, // seconds
end: 5, // seconds
src: "http://en.wikipedia.org/wiki/S%C3%A3o_Paulo",
- target: "wikidiv"
+ target: "wikidiv",
+ numberofwords: 43
} )
.volume(0)
.play();
popped.exec( 2, function() {
- ok ( theArticle.innerHTML !== "", "wikidiv now contains information" );
+ notEqual( theArticle.innerHTML, "", "wikidiv now contains information" );
plus();
- equals ( theArticle.childElementCount, 2, "wikidiv now contains two child elements" );
+ equals( theArticle.childElementCount, 2, "wikidiv now contains two child elements" );
plus();
- equals ( theArticle.children[ 0 ].innerHTML, "this is an article", "wikidiv has the right title" );
+ equals( theArticle.children[ 0 ].innerHTML, "this is an article", "wikidiv has the right title" );
plus();
- ok ( theArticle.children[ 1 ].innerHTML !=="", "wikidiv has some content" );
+ notEqual( theArticle.children[ 1 ].innerHTML, "", "wikidiv has some content" );
+ plus();
+ // subtract 1 from length for the '...' added in by the plugin
+ equals( theArticle.children[ 1 ].innerHTML.split( " " ).length -1, 22, "wikidiv contains 22 words" )
plus();
});
popped.exec( 3, function() {
- equals ( theArticle.innerHTML, "", "wikidiv was cleared properly" );
+ equals( theArticle.innerHTML, "", "wikidiv was cleared properly" );
plus();
});
popped.exec( 4, function() {
- ok ( theArticle.innerHTML !== "", "wikidiv now contains information" );
+ notEqual( theArticle.innerHTML, "", "wikidiv now contains information" );
+ plus();
+ equals( theArticle.childElementCount, 2, "wikidiv now contains two child elements" );
plus();
- equals ( theArticle.childElementCount, 2, "wikidiv now contains two child elements" );
+ notEqual( theArticle.children[ 1 ].innerHTML, "", "wikidiv has the right content" );
plus();
- ok ( theArticle.children[ 1 ].innerHTML !== "", "wikidiv has the right content" );
+ // subtract 1 from length for the '...' added in by the plugin
+ equals( theArticle.children[ 1 ].innerHTML.split(" ").length - 1, 43, "wikidiv contains 43 words" );
plus();
});
popped.exec( 6, function() {
popped.pause().removeTrackEvent( popped.data.trackEvents.byStart[ 4 ]._id );
- equals ( theArticle.innerHTML, "", "wikidiv is now empty" );
+ equals( theArticle.innerHTML, "", "wikidiv is now empty" );
plus();
});
});