Skip to content
Permalink
Browse files

Unbreak the code

  • Loading branch information...
unknown authored and shawnthompson committed Aug 6, 2015
1 parent d2fb53a commit 51e92a0b96a205f6b59226f03c8259af44c52682
Showing with 40 additions and 40 deletions.
  1. +6 −6 src/plugins/facebook/facebook.js
  2. +34 −34 src/plugins/facebook/test.js
@@ -5,15 +5,15 @@
* @author @pjackson28
*/
( function( $, window, wb ) {
"use strict";
"use strict";

/*
* Variable and function definitions.
* These are global to the plugin - meaning that they will be initialized once per page,
* not once per instance of plugin on the page. So, this is a good place to define
* variables that are common to all instances of the plugin on a page.
*/
var componentName = "wb-facebook",
var componentName = "wb-facebook",
selector = "." + componentName,
initEvent = "wb-init" + selector,
$document = wb.doc,
@@ -34,7 +34,7 @@
if ( ele ) {
Modernizr.load(
{
load: [ protocol.indexOf( "http" ) === -1 ? "http:" : protocol ) + "//connect.facebook.net/" + wb.lang + "_US/sdk.js" ],
load: [ ( protocol.indexOf( "http" ) === -1 ? "http:" : protocol ) + "//connect.facebook.net/" + wb.lang + "_US/sdk.js" ],
complete: function() {
if ( !fbinited ) {
window.FB.init( {
@@ -51,9 +51,9 @@
}
};

$document.on( "timerpoke.wb " + initEvent, selector, init );
$document.on( "timerpoke.wb " + initEvent, selector, init );

// Add the timer poke to initialize the plugin
wb.add( selector );
// Add the timer poke to initialize the plugin
wb.add( selector );

} )( jQuery, window, wb );
@@ -16,40 +16,40 @@

describe( "Facebook test suite", function() {

/*
* Test the initialization and default behaviour of the plugin
*/
var $elm,
$document = wb.doc,
$body = $document.find( "body" );

before( function( done ) {

// The facebook widget sometimes takes longer than two second to load
this.timeout( 5000 );

// Trigger plugin init
$elm = $( '<div class="wb-facebook"><div class="fb-page" data-href="https://www.facebook.com/canada150th"></div></div>' )
.appendTo( $body )
.trigger( "wb-init.wb-facebook" );

$document.on( "wb-ready.wb-facebook", ".wb-facebook", function() {
done();
} );
} );

after( function() {
$elm.remove();
} );

/*
* Test the initialization events of the plugin
*/
describe( "init event", function() {
it( "should have added the wb-facebook-inited CSS class", function() {
expect( $elm.hasClass( "wb-facebook-inited" ) ).to.equal( true );
} );
} );
/*
* Test the initialization and default behaviour of the plugin
*/
var $elm,
$document = wb.doc,
$body = $document.find( "body" );

before( function( done ) {

// The facebook widget sometimes takes longer than two second to load
this.timeout( 5000 );

// Trigger plugin init
$elm = $( "<div class='wb-facebook'><div class='fb-page' data-href='https://www.facebook.com/canada150th'></div></div>" )
.appendTo( $body )
.trigger( "wb-init.wb-facebook" );

$document.on( "wb-ready.wb-facebook", ".wb-facebook", function() {
done();
} );
} );

after( function() {
$elm.remove();
} );

/*
* Test the initialization events of the plugin
*/
describe( "init event", function() {
it( "should have added the wb-facebook-inited CSS class", function() {
expect( $elm.hasClass( "wb-facebook-inited" ) ).to.equal( true );
} );
} );

} );

0 comments on commit 51e92a0

Please sign in to comment.
You can’t perform that action at this time.