use strict;
use warnings;
use Test::More tests => 9;
use HTML::Video::Embed;
my $embeder = new HTML::Video::Embed({
class => "test-video",
});
is(
$embeder->url_to_embed('http://www.youtube.com/watch?v=xExSdzkZZB0'),
'',
'youtube embed works'
);
is(
$embeder->url_to_embed('http://www.youtube.com/watch?v=xExSdzkZZB0#t=01h53m22s'),
'',
'youtube embed works (with timecode fragment)'
);
is(
$embeder->url_to_embed('http://www.youtube.com/watch?v=xExSdzkZZB0&t=02h26m31s'),
'',
'youtube embed works (with timecode query)'
);
is(
$embeder->url_to_embed('http://www.youtube.com/watch?v=xExSdzkZZB0#t=22s'),
'',
'youtube embed works (with timecode), just seconds'
);
is(
$embeder->url_to_embed('http://www.youtube.com/watch?v=xExSdzkZZB0#t=2m3s'),
'',
'youtube embed works (with timecode), single digits'
);
is(
$embeder->url_to_embed('http://www.youtube.com/watch?v=xExSdzkZZB0#t=sdfdsf'),
'',
'youtube embed works (invalid timecode removed)'
);
is( $embeder->url_to_embed('http://www.youtube.com/watch?v=xExkZZB0'), undef, 'invalid v=');
is( $embeder->url_to_embed('http://www.youtube.com/watch?h=xExxSdzkZZB0'), undef, 'no v=');
is( $embeder->url_to_embed('http://www.y0utube.com/watch?h=xExxSdzkZZB0'), undef, 'domain check');