]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#678] Initial failing tests for implementation
authorRick Waldron <waldron.rick@gmail.com>
Mon, 8 Aug 2011 15:17:47 +0000 (11:17 -0400)
committerRick Waldron <waldron.rick@gmail.com>
Mon, 8 Aug 2011 15:17:47 +0000 (11:17 -0400)
test/popcorn.unit.js

index 7d19d05a0e742c451e117c6a31b99e6f5520878c..545f39b4f1cccbd9c5488e61a22955191ac59f58 100644 (file)
@@ -483,7 +483,7 @@ test("Popcorn.[addTrackEvent | removeTrackEvent].ref()", function() {
 
 
 
-module("Popcorn Methods");
+module("Popcorn Prototype Methods");
 
 
 
@@ -500,7 +500,7 @@ test("roundTime", function () {
 
 });
 
-  
+
 test("exec", function () {
 
   QUnit.reset();
@@ -542,6 +542,61 @@ test("exec", function () {
 
 });
 
+test("mute", function () {
+
+  var video = Popcorn("#video"),
+      audio = Popcorn("#audio"),
+      expects = 4,
+      count = 0;
+
+  expect( expects );
+
+  function plus(){
+    if ( ++count == expects ) {
+      start();
+    }
+  }
+
+  stop();
+
+
+  video.listen("muted", function() {
+
+    equal( this.media.muted, true, "Video `muted` attribute is true when muted" );
+    plus();
+
+    this.unmute();
+
+  }).listen("unmuted", function() {
+
+    equal( this.media.muted, false, "Video `muted` attribute is false when unmuted" );
+    plus();
+
+  });
+
+  audio.listen("muted", function() {
+
+    equal( this.media.muted, true, "Audio `muted` attribute is true when muted" );
+    plus();
+
+    this.unmute();
+
+  }).listen("unmuted", function() {
+
+    equal( this.media.muted, false, "Audio `muted` attribute is false when unmuted" );
+    plus();
+
+  });
+
+
+  video.mute();
+  audio.mute();
+
+});
+
+
+module("Popcorn Static Methods");
+
 test( "Popcorn.extend", function () {
 
   QUnit.reset();
@@ -1330,9 +1385,9 @@ test("Start Zero Immediately", function () {
     end: function() {}
   });
 
-  $pop.zero({ 
-    start:0, 
-    end: 2 
+  $pop.zero({
+    start:0,
+    end: 2
   });
 });
 test("Update Timer", function () {