From: Mohammed Buttu
Date: Mon, 16 May 2011 02:21:14 +0000 (-0400)
Subject: #332 Added unit tests and added/modified documentation
X-Git-Tag: v0.6~27
X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=feff581f8f8f9ef0ac882b6b913d9104106a706f;p=popcorn-js.git
#332 Added unit tests and added/modified documentation
---
diff --git a/plugins/linkedin/popcorn.linkedin.html b/plugins/linkedin/popcorn.linkedin.html
index 145309c..e37e22d 100644
--- a/plugins/linkedin/popcorn.linkedin.html
+++ b/plugins/linkedin/popcorn.linkedin.html
@@ -2,6 +2,14 @@
Popcorn LinkedIn Plug-in Demo
+
@@ -15,7 +23,7 @@
counter : 'right',
url : "http://www.google.ca",
target : "sharediv",
- api_key : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
start : 1,
end : 3
} )
@@ -25,7 +33,7 @@
target : "recommenddiv",
companyid : 'LinkedIn',
productid : '201714',
- api_key : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
start : 4,
end : 7
} )
@@ -34,7 +42,7 @@
memberid : '/in/jeffweiner08',
format : 'inline',
target : "memberprofilediv",
- api_key : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
start : 9,
end : 11
} )
@@ -42,7 +50,7 @@
type : 'companyinsider',
companyid : '1441',
target : "bottomdiv",
- api_key : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
start : 9,
end : 11
} )
@@ -51,7 +59,7 @@
companyid : '1441',
format : 'inline',
target : "bottomdiv",
- api_key : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
start : 13,
end : 17
} )
@@ -63,7 +71,8 @@
Right of video: share button, recommend button, member profile.
Below video: company insider, company profile.
- For a description of each plugin's purpose, go to: LinkedIn Plugins
+ For a description of each plugin's purpose, go to: LinkedIn Plugins
+
- * var api_key = 'ND1uSIEUBH8MkI8E7g41kgGlWUexzvFL9uB2ihJbIrFuqunFq8aVmUrxyfAqxCBX';
- *
*
* ...
* var p = Popcorn('#video')
@@ -25,9 +21,12 @@
* url : "http://www.google.ca",
* counter : "right",
* target : 'sharediv'
+ * api_key : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ * start : 1,
+ * end : 3
* } )
*
- * This will show how many people have "shared" Google (default url is current page, if non specified) via LinkedIn.
+ * This will show how many people have "shared" Google (default url is current page, if none specified) via LinkedIn.
* Will show number of people (counter) to the right of the share plugin.
*/
@@ -46,7 +45,7 @@
},
_setup: function( options ) {
- var api_key = options.api_key,
+ var api_key = options.apikey,
target = document.getElementById( options.target );
options._container = document.createElement( 'script' );
@@ -125,11 +124,23 @@
}
target.style.display = 'none';
},
-
+
+ /**
+ * @member linkedin
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
+ * options variable
+ */
start: function( event, options ) {
options._container.parentNode.style.display = 'block';
},
+ /**
+ * @member linkedin
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
+ * options variable
+ */
end: function( event, options ) {
options._container.parentNode.style.display = 'none';
}
diff --git a/plugins/linkedin/popcorn.linkedin.unit.html b/plugins/linkedin/popcorn.linkedin.unit.html
new file mode 100644
index 0000000..8fd8059
--- /dev/null
+++ b/plugins/linkedin/popcorn.linkedin.unit.html
@@ -0,0 +1,43 @@
+
+
+
+ Popcorn API
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Your user agent does not support the HTML5 Video element.
+
+
+
+
+
diff --git a/plugins/linkedin/popcorn.linkedin.unit.js b/plugins/linkedin/popcorn.linkedin.unit.js
new file mode 100644
index 0000000..105a444
--- /dev/null
+++ b/plugins/linkedin/popcorn.linkedin.unit.js
@@ -0,0 +1,48 @@
+test("Popcorn LinkedIn Plugin", function () {
+
+ var popped = Popcorn("#video"),
+ expects = 5,
+ count = 0,
+ linkedin = document.getElementById('linkedindiv');
+
+ expect( expects );
+
+ function plus() {
+ if ( ++count === expects) {
+ start();
+ }
+ }
+
+ stop();
+
+ ok('linkedin' in popped, "linkedin is a method of the popped instance");
+ plus();
+
+ equals ( linkedin.innerHTML, "", "initially, there is nothing inside the linkedin div" );
+ plus();
+
+
+ popped.linkedin({
+ type : 'share',
+ counter : 'right',
+ url : "http://www.google.ca",
+ target : "linkedindiv",
+ apikey : 'ZOLRI2rzQS_oaXELpPF0aksxwFFEvoxAFZRLfHjaAhcGPfOX0Ds4snkJpWwKs8gk',
+ start : 1,
+ end : 3
+ } );
+
+ popped.exec( 2, function() {
+ ok( /block/.test( linkedin.style.display ), "Div contents are displayed" );
+ plus();
+ ok( /script/.test( linkedin.innerHTML ), "LinkedIn plugin exists" );
+ plus();
+ });
+
+ popped.exec( 4, function() {
+ ok( /none/.test( linkedin.style.display ), "Div contents are hidden again" );
+ plus();
+ });
+ popped.volume(0).play();
+
+});