]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
1. Added youtube unit test for underscores in urls.
authorsecretrobotron <secretrobotron@gmail.com>
Tue, 17 May 2011 15:51:05 +0000 (11:51 -0400)
committersecretrobotron <secretrobotron@gmail.com>
Tue, 17 May 2011 15:51:05 +0000 (11:51 -0400)
2. Added 'expected' field to each url test.

players/youtube/popcorn.youtube.unit.js

index 127024d460e9bc43e37f749a2d0fb105dccc3237..b79d2be52d12160e32d453a5f2b75b2cc6e3576a 100644 (file)
@@ -193,18 +193,27 @@ test( "Popcorn YouTube Plugin Url Regex Test", function() {
   var urlTests = [
     { name: 'standard',
       url: 'http://www.youtube.com/watch?v=9oar9glUCL0',
+      expected: '9oar9glUCL0',
     },
     { name: 'share url',
       url: 'http://youtu.be/9oar9glUCL0',
+      expected: '9oar9glUCL0',
     },
     { name: 'long embed',
       url: 'http://www.youtube.com/embed/9oar9glUCL0',
+      expected: '9oar9glUCL0',
     },
     { name: 'short embed 1 (e)',
       url: 'http://www.youtube.com/e/9oar9glUCL0',
+      expected: '9oar9glUCL0',
     },
     { name: 'short embed 2 (v)',
       url: 'http://www.youtube.com/v/9oar9glUCL0',
+      expected: '9oar9glUCL0',
+    },
+    { name: 'contains underscore',
+      url: 'http://www.youtube.com/v/GP53b__h4ew',
+      expected: 'GP53b__h4ew',
     },
   ];
 
@@ -216,7 +225,7 @@ test( "Popcorn YouTube Plugin Url Regex Test", function() {
     var urlTest = urlTests[t],
         popcorn = Popcorn( Popcorn.youtube( 'video3', urlTest.url ) );
 
-    equals( popcorn.video.vidId, '9oar9glUCL0', 'Video id is correct for ' + urlTest.name + ': ' + urlTest.url );
+    equals( popcorn.video.vidId, urlTest.expected, 'Video id is correct for ' + urlTest.name + ': ' + urlTest.url );
     popcorn.pause();
 
     // Get rid of the youtube object inside the video3, to keep things simple