From: secretrobotron Date: Tue, 17 May 2011 15:51:05 +0000 (-0400) Subject: 1. Added youtube unit test for underscores in urls. X-Git-Tag: v0.6~2^2~6^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=92fef6693721b3869aee92fca10b87fb1fcbafec;p=popcorn-js.git 1. Added youtube unit test for underscores in urls. 2. Added 'expected' field to each url test. --- diff --git a/players/youtube/popcorn.youtube.unit.js b/players/youtube/popcorn.youtube.unit.js index 127024d..b79d2be 100644 --- a/players/youtube/popcorn.youtube.unit.js +++ b/players/youtube/popcorn.youtube.unit.js @@ -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