From 7ece093760eb43632a2473828f6ef1eeebae3ef8 Mon Sep 17 00:00:00 2001 From: Anna Sobiepanek Date: Mon, 31 Jan 2011 12:35:30 -0500 Subject: [PATCH] fixtd options.title and wrote tests [#293] --- plugins/wikipedia/popcorn.wikipedia.html | 1 + plugins/wikipedia/popcorn.wikipedia.js | 2 +- plugins/wikipedia/popcorn.wikipedia.unit.js | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/wikipedia/popcorn.wikipedia.html b/plugins/wikipedia/popcorn.wikipedia.html index 8026a922..067fab37 100644 --- a/plugins/wikipedia/popcorn.wikipedia.html +++ b/plugins/wikipedia/popcorn.wikipedia.html @@ -14,6 +14,7 @@ start: 0, // seconds end: 10, // seconds src: 'http://en.wikipedia.org/wiki/Cape_Town', + title: "this is an article", target: 'wikidiv' } ) .wikipedia({ diff --git a/plugins/wikipedia/popcorn.wikipedia.js b/plugins/wikipedia/popcorn.wikipedia.js index 75041ff9..190c2f36 100644 --- a/plugins/wikipedia/popcorn.wikipedia.js +++ b/plugins/wikipedia/popcorn.wikipedia.js @@ -76,7 +76,7 @@ var wikiCallback; 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 diff --git a/plugins/wikipedia/popcorn.wikipedia.unit.js b/plugins/wikipedia/popcorn.wikipedia.unit.js index 6355ac94..89ff683a 100644 --- a/plugins/wikipedia/popcorn.wikipedia.unit.js +++ b/plugins/wikipedia/popcorn.wikipedia.unit.js @@ -1,7 +1,7 @@ test("Popcorn wikipedia Plugin", function () { var popped = Popcorn("#video"), - expects = 7, + expects = 9, count = 0, theArticle = document.getElementById('wikidiv'), wikiInterval, @@ -30,6 +30,7 @@ test("Popcorn wikipedia Plugin", function () { start: 5, // seconds end: 10, // seconds src: 'http://en.wikipedia.org/wiki/Cape_Town', + title: "this is an article", target: 'wikidiv' } ) .wikipedia({ @@ -48,6 +49,8 @@ test("Popcorn wikipedia Plugin", function () { 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 );