Skip to content

Commit

Permalink
Make Facebook Plugin divs initially hidden [#897]
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher De Cairos committed Mar 2, 2012
2 parents 10ccce1 + c85c826 commit 0d8804c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions plugins/facebook/popcorn.facebook.js
Expand Up @@ -210,6 +210,7 @@
options._container.id = "facebookdiv-" + Popcorn.guid();
options._facebookdiv = document.createElement( "fb:" + _type );
options._container.appendChild( options._facebookdiv );
options._container.style.display = "none";

// All the the "types" for facebook share largely identical attributes, for loop suffices.
// ** Credit to Rick Waldron, it's essentially all his code in this function.
Expand Down
13 changes: 9 additions & 4 deletions plugins/facebook/popcorn.facebook.unit.js
Expand Up @@ -3,13 +3,14 @@ test( "Popcorn Facebook Plugin", function () {
Popcorn.plugin.debug = true;

var popped = Popcorn( "#video" ),
expects = 15,
expects = 16,
count = 0,
interval,
interval2,
interval3,
interval4,
likediv = document.getElementById( "likediv" );
likediv = document.getElementById( "likediv" ),
commentdiv = document.getElementById( "commentdiv" );

expect( expects );

Expand Down Expand Up @@ -65,7 +66,7 @@ test( "Popcorn Facebook Plugin", function () {
href: "example.com",
type: "COMMENTS",
target: "commentdiv",
start: 1,
start: 2,
end: 6,
num_posts: 5
})
Expand All @@ -86,14 +87,18 @@ test( "Popcorn Facebook Plugin", function () {
ok( document.getElementById( "commentdiv" ), "commentdiv exists on the page" );
plus();

popped.exec( 1, function() {
equals( commentdiv.children[ 0 ].style.display, "none", "comment div is not visible on page with \"none\" display style" );
plus();
});
// I inspected the html genterated by facebook, and found that there are no uniquely identifying attributes between plug-in types
// so right now, we just check ot make sure that facebook is returning a plugin and displaying it at the correct time.
popped.exec( 3, function() {
// Counts number of children elements in likediv
equals( likediv.childElementCount, 2, "likediv has 2 inner elements" );
plus();
// Checks display style is set correctly on startup
equals( likediv.children[ 0 ].style.display , "", "likediv is visible on the page with '' display style" );
equals( likediv.children[ 0 ].style.display , "", "likediv is visible on the page with \"\" display style" );
plus();
// Checks if likediv is empty at specific time
ok( document.getElementById( "likediv" ).innerHTML, "likediv is not empty at 0:03 (expected)" );
Expand Down

0 comments on commit 0d8804c

Please sign in to comment.