]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
fixtd options.title and wrote tests [#293]
authorAnna Sobiepanek <annaopensource@gmail.com>
Mon, 31 Jan 2011 17:35:30 +0000 (12:35 -0500)
committerAnna Sobiepanek <annaopensource@gmail.com>
Mon, 31 Jan 2011 17:35:30 +0000 (12:35 -0500)
plugins/wikipedia/popcorn.wikipedia.html
plugins/wikipedia/popcorn.wikipedia.js
plugins/wikipedia/popcorn.wikipedia.unit.js

index 8026a922b8c054125f35511d7a23968dc0ac1dff..067fab370575d5fb2f8fee29c1c1e761cfa311e5 100644 (file)
@@ -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({
index 75041ff9cd2a9c085e0d88a88938e71e62801be3..190c2f36f9e436c6c1132ee026d29fddb933d83c 100644 (file)
@@ -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
index 6355ac94f9650a62bb6faccf48cc0f2b9225271c..89ff683a63eb90e0866956813cca03f67ec8af00 100644 (file)
@@ -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 );