Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 37 lines (30 sloc) 2.28 kB
fc5d3d9 @LiNiO Formatter/YouTube.pm: Allow to embed youtube video player
LiNiO authored
1 #!/usr/bin/perl -w
2 use MojoMojo::Formatter::YouTube;
5fa0a0a @dandv Updated tests to use DummyCatalystObject instead of repeatedly defini…
dandv authored
3 use Test::More tests => 5;
4 use lib 't/lib';
24e80be @dandv Renamed DummyCatalystObject to FakeCatalystObject per 'xUnit Patterns'
dandv authored
5 use FakeCatalystObject;
fc5d3d9 @LiNiO Formatter/YouTube.pm: Allow to embed youtube video player
LiNiO authored
6
5fa0a0a @dandv Updated tests to use DummyCatalystObject instead of repeatedly defini…
dandv authored
7 my $content;
24e80be @dandv Renamed DummyCatalystObject to FakeCatalystObject per 'xUnit Patterns'
dandv authored
8 my $fake_c = FakeCatalystObject->new;
fc5d3d9 @LiNiO Formatter/YouTube.pm: Allow to embed youtube video player
LiNiO authored
9
10 $content = " youtube http://www.youtube.com/abc";
11 MojoMojo::Formatter::YouTube->format_content(\$content, $fake_c, undef);
12 #warn("Content is $content");
5fa0a0a @dandv Updated tests to use DummyCatalystObject instead of repeatedly defini…
dandv authored
13 is($content, " youtube http://www.youtube.com/abc\n", "no youtube formatter line");
fc5d3d9 @LiNiO Formatter/YouTube.pm: Allow to embed youtube video player
LiNiO authored
14
15 $fake_c->set_reverse('pageadmin/edit');
16 $content = "{{youtube http://www.youtube.com/v=abcABC0}}\n";
17 MojoMojo::Formatter::YouTube->format_content(\$content, $fake_c, undef);
18 #warn("Content is $content");
5fa0a0a @dandv Updated tests to use DummyCatalystObject instead of repeatedly defini…
dandv authored
19 is($content, qq(<div style='width: 425px;height: 344px; border: 1px black dotted;'>Faking localization... YouTube Video ...fake complete.<br /><a href="http://www.youtube.com/v=abcABC0">http://www.youtube.com/v=abcABC0</a></div>\n));
fc5d3d9 @LiNiO Formatter/YouTube.pm: Allow to embed youtube video player
LiNiO authored
20
21 $fake_c->set_reverse('jsrpc/render');
22 $content = "{{youtube http://www.youtube.com/v=abcABC0}} xx\n";
23 MojoMojo::Formatter::YouTube->format_content(\$content, $fake_c, undef);
24 #warn("Content is $content");
5fa0a0a @dandv Updated tests to use DummyCatalystObject instead of repeatedly defini…
dandv authored
25 is($content, qq(<div style='width: 425px;height: 344px; border: 1px black dotted;'>Faking localization... YouTube Video ...fake complete.<br /><a href="http://www.youtube.com/v=abcABC0">http://www.youtube.com/v=abcABC0</a></div> xx\n));
fc5d3d9 @LiNiO Formatter/YouTube.pm: Allow to embed youtube video player
LiNiO authored
26
27 $content = "{{youtube http://wwwwwwww.youtube.com/abc}}";
28 MojoMojo::Formatter::YouTube->format_content(\$content, $fake_c, undef);
29 #warn("Content is $content");
5fa0a0a @dandv Updated tests to use DummyCatalystObject instead of repeatedly defini…
dandv authored
30 is($content, "Faking localization... YouTube Video ...fake complete.: http://wwwwwwww.youtube.com/abc Faking localization... is not a valid link to youtube video ...fake complete.\n", "no youtube link");
fc5d3d9 @LiNiO Formatter/YouTube.pm: Allow to embed youtube video player
LiNiO authored
31
32 $fake_c->set_reverse('');
33 $content = "{{youtube http://www.youtube.com/watch?v=ABC_abc_09}}";
34 MojoMojo::Formatter::YouTube->format_content(\$content, $fake_c, undef);
35 #warn("Content is $content");
36 is($content, qq(<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/ABC_abc_09&hl=en"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ABC_abc_09&hl=en" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>\n));
Something went wrong with that request. Please try again.