Skip to content

Commit

Permalink
Merge remote branch 'scott/t484' into 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna Sobiepanek committed May 17, 2011
2 parents 03ac178 + ad7a070 commit 9d7ff65
Show file tree
Hide file tree
Showing 26 changed files with 271 additions and 167 deletions.
8 changes: 5 additions & 3 deletions plugins/attribution/popcorn.attribution.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 16 additions & 9 deletions plugins/attribution/popcorn.attribution.unit.js
@@ -1,8 +1,9 @@
test("Popcorn attribution Plugin", function () {

var popped = Popcorn("#video"),
expects = 7,
expects = 8,
count = 0,
setupId,
attributiondiv = document.getElementById('attribdiv');

expect(expects);
Expand All @@ -24,16 +25,16 @@ test("Popcorn attribution Plugin", function () {

popped.attribution({
start: 0, // seconds
end: 5, // seconds
end: 0.5, // seconds
nameofwork: "A Shared Culture",
copyrightholder:"Jesse Dylan",
license: "CC-BY-N6",
licenseurl: "http://creativecommons.org/licenses/by-nc/2.0/",
target: 'attribdiv'
} )
.attribution({
start: 3, // seconds
end: 10, // seconds
start: 0.5, // seconds
end: 1, // seconds
nameofwork: "Internet",
nameofworkurl:"http://www.archive.org/details/CC1232_internet",
copyrightholder:"The Computer Chronicles",
Expand All @@ -43,22 +44,28 @@ test("Popcorn attribution Plugin", function () {
} )
.volume(0);

popped.exec( 1, function() {
setupId = popped.getLastTrackEventId();

popped.exec( 0, function() {
equals ( attributiondiv.childElementCount, 2, "attributiondiv now has two inner elements" );
plus();
equals (attributiondiv.children[0].style.display , "inline", "attribution is visible on the page" );
plus();
});

popped.exec( 4, function() {
popped.exec( 0.5, function() {
equals (attributiondiv.children[1].style.display , "inline", "second attribution is visible on the page" );
plus();
});

popped.exec( 11, function() {
equals (attributiondiv.children[1].style.display , "none", "second attribution is no longer visible on the page" );
popped.exec( 1, function() {
equals(attributiondiv.children[1].style.display , "none", "second attribution is no longer visible on the page" );
plus();
equals (attributiondiv.children[0].style.display , "none", "first attribution is no longer visible on the page" );
equals(attributiondiv.children[0].style.display , "none", "first attribution is no longer visible on the page" );
plus();

popped.pause().removeTrackEvent( setupId );
ok( !attributiondiv.children[1], "removed attribution was properly destroyed" );
plus();
});

Expand Down
3 changes: 3 additions & 0 deletions plugins/flickr/popcorn.flickr.js
Expand Up @@ -139,6 +139,9 @@
*/
end: function( event, options ){
containerDiv.style.display = "none";
},
_teardown: function( options ) {
document.getElementById( options.target ) && document.getElementById( options.target ).removeChild( containerDiv );
}
};
},
Expand Down
28 changes: 17 additions & 11 deletions plugins/flickr/popcorn.flickr.unit.js
@@ -1,8 +1,9 @@
test("Popcorn Flickr Plugin", function () {

var popped = Popcorn("#video"),
expects = 7,
expects = 8,
count = 0,
setupId,
flickrdiv = document.getElementById('flickrdiv');

expect( expects );
Expand All @@ -22,40 +23,45 @@ test("Popcorn Flickr Plugin", function () {
plus();

popped.flickr({
start: 1, // seconds
end: 3, // seconds
start: 0, // seconds
end: 1, // seconds
userid: '35034346917@N01',
numberofimages: '1',
target: 'flickrdiv'
} )
.flickr({
start: 4, // seconds
end: 7, // seconds
start: 1, // seconds
end: 2, // seconds
username: 'AniaSob',
apikey: 'd1d249260dd1673ec8810c8ce5150ae1',
numberofimages: '1',
target: 'flickrdiv'
} );;
});

popped.exec( 2, function() {
setupId = popped.getLastTrackEventId();

popped.exec( 0.5, function() {
ok( /display: inline;/.test( flickrdiv.innerHTML ), "Div contents are displayed" );
plus();
ok( /img/.test( flickrdiv.innerHTML ), "An image exists" );
plus();
});

popped.exec( 5, function() {
popped.exec( 1.5, function() {
ok( /display: inline;/.test( flickrdiv.innerHTML ), "Div contents are displayed" );
plus();
ok( /img/.test( flickrdiv.innerHTML ), "An image exists" );
plus();
});

popped.exec( 7, function() {
popped.exec( 2, function() {
ok( /display: none;/.test( flickrdiv.innerHTML ), "Div contents are hidden again" );
plus();

popped.pause().removeTrackEvent( setupId );
ok( !flickrdiv.children[1], "removed flickr was properly destroyed" );
plus();
});
popped.volume(0);
popped.play();
popped.volume(0).play();

});
11 changes: 6 additions & 5 deletions plugins/footnote/popcorn.footnote.js
Expand Up @@ -44,9 +44,8 @@
options._container = document.createElement( 'div' );
options._container.style.display = "none";
options._container.innerHTML = options.text;
if ( document.getElementById( options.target ) ) {
document.getElementById( options.target ).appendChild( options._container );
}

document.getElementById( options.target ) && document.getElementById( options.target ).appendChild( options._container );
},
/**
* @member footnote
Expand All @@ -65,8 +64,10 @@
*/
end: function(event, options){
options._container.style.display = "none";
},
_teardown: function( options ) {
document.getElementById( options.target ) && document.getElementById( options.target ).removeChild( options._container );
}

});

})( Popcorn );
})( Popcorn );
28 changes: 17 additions & 11 deletions plugins/footnote/popcorn.footnote.unit.js
@@ -1,8 +1,9 @@
test("Popcorn Footnote Plugin", function () {

var popped = Popcorn("#video"),
expects = 7,
expects = 8,
count = 0,
setupId,
footnotediv = document.getElementById('footnotediv');

expect(expects);
Expand All @@ -23,19 +24,20 @@ test("Popcorn Footnote Plugin", function () {

popped.footnote({
start: 0, // seconds
end: 2, // seconds
end: 1, // seconds
text: 'This video made exclusively for drumbeat.org',
target: 'footnotediv'
} )
})
.footnote({
start: 2, // seconds
end: 4, // seconds
start: 1, // seconds
end: 2, // seconds
text: 'Visit webmademovies.org for more details',
target: 'footnotediv'
} )
.volume(0);
});

popped.exec( 1, function() {
setupId = popped.getLastTrackEventId();

popped.exec( 0, function() {
equals ( footnotediv.childElementCount, 2, "footnotediv now has two inner elements" );
plus();
equals (footnotediv.children[0].innerHTML , "This video made exclusively for drumbeat.org", "footnote displaing correct information" );
Expand All @@ -44,15 +46,19 @@ test("Popcorn Footnote Plugin", function () {
plus();
});

popped.exec( 3, function() {
popped.exec( 1, function() {
equals (footnotediv.children[1].style.display , "inline", "second footnote is visible on the page" );
plus();
});

popped.exec( 5, function() {
popped.exec( 2, function() {
ok (footnotediv.children[1].style.display === 'none' && footnotediv.children[0].style.display === 'none', "footnote are no longer vidible on the page" );
plus();

popped.pause().removeTrackEvent( setupId );
ok( !footnotediv.children[1], "removed footnote was properly destroyed" );
plus();
});
popped.play();
popped.play().volume(0);

});
11 changes: 7 additions & 4 deletions plugins/googlefeed/popcorn.googlefeed.js
Expand Up @@ -51,9 +51,8 @@
newdiv.style.width = "100%";
newdiv.style.height = "100%";
i++;
if ( document.getElementById( options.target ) ) {
document.getElementById( options.target ).appendChild( newdiv );
}

document.getElementById( options.target ) && document.getElementById( options.target ).appendChild( newdiv );

var initialize = function() {
//ensure that the script has been loaded
Expand All @@ -63,7 +62,7 @@
}, 5);
} else {
// Create the feed control using the user entered url and title
var tmp = new GFdynamicFeedControl( options.url, newdiv, {
options.feed = new GFdynamicFeedControl( options.url, newdiv, {
vertical: options.orientation.toLowerCase() == "vertical" ? true : false,
horizontal: options.orientation.toLowerCase() == "horizontal" ? true : false,
title: options.title = options.title || "Blog"
Expand Down Expand Up @@ -112,6 +111,10 @@
*/
end: function(event, options){
newdiv.setAttribute( "style", "display:none" );
},
_teardown: function( options ) {
document.getElementById( options.target ) && document.getElementById( options.target ).removeChild( newdiv );
delete options.feed;
}
};
},
Expand Down
75 changes: 41 additions & 34 deletions plugins/googlefeed/popcorn.googlefeed.unit.js
@@ -1,7 +1,8 @@
test("Popcorn Google Feed Plugin", function () {

var popped = Popcorn("#video"),
expects = 10,
expects = 11,
setupId,
count = 0;

expect(expects);
Expand All @@ -22,43 +23,49 @@ test("Popcorn Google Feed Plugin", function () {
plus();

popped.googlefeed({
start: 0, // seconds
end: 5, // seconds
target: "feed",
url: "http://zenit.senecac.on.ca/~chris.tyler/planet/rss20.xml",
title: "Planet Feed",
orientation: "Vertical"
} )
.googlefeed({
start: 0, // seconds
end: 5, // seconds
target: "feed1",
url: "http://blog.pikimal.com/geek/feed/",
title: "pikiGeek",
orientation: "Horizontal"
} )
.volume(0);
start: 0, // seconds
end: 1, // seconds
target: "feed",
url: "http://zenit.senecac.on.ca/~chris.tyler/planet/rss20.xml",
title: "Planet Feed",
orientation: "Vertical"
})
.googlefeed({
start: 0, // seconds
end: 2, // seconds
target: "feed1",
url: "http://blog.pikimal.com/geek/feed/",
title: "pikiGeek",
orientation: "Horizontal"
})
.volume(0);

setupId = popped.getLastTrackEventId();

popped.exec( 0, function() {
ok(google.load, "Google Feed is available");
plus();
ok(GFdynamicFeedControl, "Dynamic Feed Control Available");
plus();
ok (document.getElementById('_feed1'), "First feed is on the page" );
plus();
equals (document.getElementById('_feed1').offsetParent.id, "feed", "First feed is inside the 'feed' div" );
plus();
});
popped.exec( 1, function() {
ok(google.load, "Google Feed is available");
plus();
ok(GFdynamicFeedControl, "Dynamic Feed Control Available");
plus();
ok (document.getElementById('_feed1'), "First feed is on the page" );
plus();
equals (document.getElementById('_feed1').offsetParent.id, "feed", "First feed is inside the 'feed' div" );
plus();
ok (document.getElementById('_feed2'), "Second feed is on the page" );
plus();
equals (document.getElementById('_feed2').offsetParent.id, "feed1", "Second feed is inside the 'feed2' div" );
plus();
});
popped.exec( 2, function() {
ok (document.getElementById('_feed2'), "Second feed is on the page" );
plus();
equals (document.getElementById('_feed2').offsetParent.id, "feed1", "Second feed is inside the 'feed2' div" );
plus();
});
popped.exec( 6, function() {
ok (document.getElementById('_feed2').style.display === "none" &&
document.getElementById('_feed1').style.display === "none", "Both feeds are no lnger visible" );
plus();
ok (document.getElementById('_feed2').style.display === "none" &&
document.getElementById('_feed1').style.display === "none", "Both feeds are no lnger visible" );
plus();

popped.pause().removeTrackEvent( setupId );
ok( !document.getElementById('feed1').children[0], "removed feed was properly destroyed" );
plus();
});

popped.play();
Expand Down
2 changes: 1 addition & 1 deletion plugins/googlemap/popcorn.googlemap.js
Expand Up @@ -189,7 +189,7 @@ var googleCallback;
},
_teardown: function( options ) {
// the map must be manually removed
document.getElementById( options.target ).removeChild( newdiv );
document.getElementById( options.target ) && document.getElementById( options.target ).removeChild( newdiv );
newdiv = map = location = null;
}
};
Expand Down
4 changes: 1 addition & 3 deletions plugins/googlemap/popcorn.googlemap.unit.js
Expand Up @@ -76,9 +76,7 @@ test("Popcorn Google Map Plugin", function () {
ok (document.getElementById('actualmap2').style.display === "none" &&
document.getElementById('actualmap1').style.display === "none", "Both maps are no longer visible" );
plus();
popped.pause();

popped.removeTrackEvent( setupId );
popped.pause().removeTrackEvent( setupId );

ok( !document.getElementById('actualmap3'), "removed map was properly destroyed" );
plus();
Expand Down

0 comments on commit 9d7ff65

Please sign in to comment.