options._link.setAttribute('href', options.src);
options._link.setAttribute('target', '_blank');
// add the title of the article to the link
- options._link.innerHTML = data.parse.displaytitle;
+ options._link.innerHTML = options.title || data.parse.displaytitle;
// get the content of the wiki article
options._desc = document.createElement('p');
// get the article text and remove any special characters
test("Popcorn wikipedia Plugin", function () {
var popped = Popcorn("#video"),
- expects = 7,
+ expects = 9,
count = 0,
theArticle = document.getElementById('wikidiv'),
wikiInterval,
start: 5, // seconds
end: 10, // seconds
src: 'http://en.wikipedia.org/wiki/Cape_Town',
+ title: "this is an article",
target: 'wikidiv'
} )
.wikipedia({
plus();
equals (theArticle.childElementCount, 2, "wikidiv now contains two child elements" );
plus();
+ equals (theArticle.childElement[0].innerHTML, "this is an article", "wikidiv has the right title" );
+ plus();
equals (theArticle.childElement[1].innerHTML, "Cape Town metropolitan municipality. It is the provincial capital and primate city ...", "wikidiv has the right content" );
plus();
clearInterval( wikiInterval );