зеркало из https://github.com/mozilla/popcorn-js.git
Merge branch 'wikiPlugin' into 0.3
This commit is contained in:
Коммит
33ecf35d89
|
@ -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({
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
|
|
Загрузка…
Ссылка в новой задаче