]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#657] Style and formatting
authorRick Waldron <waldron.rick@gmail.com>
Wed, 20 Jul 2011 19:31:14 +0000 (15:31 -0400)
committerRick Waldron <waldron.rick@gmail.com>
Wed, 20 Jul 2011 19:31:14 +0000 (15:31 -0400)
plugins/footnote/popcorn.footnote.js
plugins/footnote/popcorn.footnote.unit.html
plugins/footnote/popcorn.footnote.unit.js

index fba5771f281c18503423438bbcde048f328e0b9f..44ce4e33763e8601b280bca2564271302badffc1 100755 (executable)
     Popcorn.plugin( name , {
 
       manifest: {
-        about:{
+        about: {
           name: "Popcorn " + name + " Plugin",
           version: "0.2",
           author: "@annasob, @rwaldron",
           website: "annasob.wordpress.com"
         },
-        options:{
-          start    : {elem:'input', type:'text', label:'In'},
-          end      : {elem:'input', type:'text', label:'Out'},
-          target   : name + '-container',
-          text     : {elem:'input', type:'text', label:'Text'}
+        options: {
+          start: { elem: "input", type: "text", label: "In" },
+          end: { elem: "input", type: "text", label: "Out" },
+          text: { elem: "input", type: "text", label: "Text" },
+          target: name + "-container"
         }
       },
-      _setup: function(options) {
-        options._container = document.createElement( 'div' );
+      _setup: function( options ) {
+        options._container = document.createElement( "div" );
         options._container.style.display = "none";
         options._container.innerHTML  = options.text;
 
@@ -58,7 +58,7 @@
        * of the video  reaches the start time provided by the
        * options variable
        */
-      start: function(event, options){
+      start: function( event, options ) {
         options._container.style.display = "inline";
       },
       /**
@@ -67,7 +67,7 @@
        * of the video  reaches the end time provided by the
        * options variable
        */
-      end: function(event, options){
+      end: function( event, options ) {
         options._container.style.display = "none";
       },
       _teardown: function( options ) {
index 6777a99ea392d25df87193e508b57451afe55882..ba39a85ffc64ee0aee84730f85c1051011cdf274 100755 (executable)
@@ -4,11 +4,11 @@
   <title>Popcorn API</title>
   <link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen">
   <script src="../../test/qunit/qunit.js"></script>
-  <!-- 
-    do not move - this must be called immediately prior to 
+  <!--
+    do not move - this must be called immediately prior to
     popcorn-api-draft.js
   -->
-  
+
   <script src="../../popcorn.js"></script>
   <script src="popcorn.footnote.js"></script>
 
   <h2 id="qunit-userAgent"></h2>
   <ol id="qunit-tests"></ol>
   <div id="qunit-fixture">  </div>
-  
-  <video id='video' 
-    controls preload='none' 
+
+  <video id='video'
+    controls preload='none'
     width= '250px'
-    poster="../../test/poster.png"> 
+    poster="../../test/poster.png">
 
     <source id='mp4'
       src="../../test/trailer.mp4"
-      type='video/mp4; codecs="avc1, mp4a"'> 
+      type='video/mp4; codecs="avc1, mp4a"'>
 
     <source id='ogv'
       src="../../test/trailer.ogv"
-      type='video/ogg; codecs="theora, vorbis"'> 
+      type='video/ogg; codecs="theora, vorbis"'>
 
-    <p>Your user agent does not support the HTML5 Video element.</p> 
+    <p>Your user agent does not support the HTML5 Video element.</p>
 
-  </video> 
-  <div id="footnotediv"></div>  
+  </video>
+  <div id="footnotediv"></div>
+  <div id="textdiv"></div>
 </body>
 </html>
index 2539c6d4ece55bdd037826eeac0ea6eb24f03b13..dbdf83f16a850aa3b417da0f0240201ce39662f6 100755 (executable)
@@ -1,38 +1,38 @@
 test("Popcorn Footnote Plugin", function () {
-  
+
   var popped = Popcorn("#video"),
-      expects = 8, 
+      expects = 8,
       count = 0,
       setupId,
-      footnotediv = document.getElementById('footnotediv');
-  
+      footnotediv = document.getElementById("footnotediv");
+
   expect(expects);
-  
+
   function plus() {
     if ( ++count===expects) {
       start();
     }
   }
-  
+
   stop();
-   
-  ok ('footnote' in popped, "footnote is a mehtod of the popped instance");
+
+  ok ("footnote" in popped, "footnote is a mehtod of the popped instance");
   plus();
-  
+
   equals ( footnotediv.childElementCount, 0, "initially, there is nothing inside the footnotediv" );
   plus();
-  
+
   popped.footnote({
     start: 0, // seconds
     end: 2, // seconds
-    text: 'This video made exclusively for drumbeat.org',
-    target: 'footnotediv'
+    text: "This video made exclusively for drumbeat.org",
+    target: "footnotediv"
   })
   .footnote({
     start: 2, // seconds
     end: 4, // seconds
-    text: 'Visit webmademovies.org for more details',
-    target: 'footnotediv'
+    text: "Visit webmademovies.org for more details",
+    target: "footnotediv"
   });
 
   setupId = popped.getLastTrackEventId();
@@ -60,5 +60,42 @@ test("Popcorn Footnote Plugin", function () {
     plus();
   });
   popped.play().volume(0);
-  
+
+});
+
+
+test("Popcorn Text Plugin", function () {
+
+  var popped = Popcorn("#video"),
+      expects = 2,
+      count = 0,
+      setupId,
+      textdiv = document.getElementById( "textdiv" );
+
+  expect(expects);
+
+  function plus() {
+    if ( ++count===expects) {
+      start();
+    }
+  }
+
+  ok( "text" in popped, "text is a method of the popped instance" );
+  plus();
+
+  popped.text({
+    start: 0, // seconds
+    end: 3, // seconds
+    text: "I am an alias",
+    target: "textdiv"
+  });
+
+  stop();
+
+  popped.exec( 2, function() {
+
+    equal( textdiv.children[0].innerHTML , "I am an alias", "I am an alias set by Popcorn.p.text" );
+    plus();
+
+  }).currentTime(1).play();
 });