Skip to content
This repository
Newer
Older
100644 36 lines (30 sloc) 2.28 kb
fc5d3d99 » LiNiO
2009-04-19 Formatter/YouTube.pm: Allow to embed youtube video player
1 #!/usr/bin/perl -w
2 use MojoMojo::Formatter::YouTube;
5fa0a0a3 » dandv
2009-04-22 Updated tests to use DummyCatalystObject instead of repeatedly defini…
3 use Test::More tests => 5;
4 use lib 't/lib';
24e80be9 » dandv
2009-05-06 Renamed DummyCatalystObject to FakeCatalystObject per 'xUnit Patterns'
5 use FakeCatalystObject;
fc5d3d99 » LiNiO
2009-04-19 Formatter/YouTube.pm: Allow to embed youtube video player
6
5fa0a0a3 » dandv
2009-04-22 Updated tests to use DummyCatalystObject instead of repeatedly defini…
7 my $content;
24e80be9 » dandv
2009-05-06 Renamed DummyCatalystObject to FakeCatalystObject per 'xUnit Patterns'
8 my $fake_c = FakeCatalystObject->new;
fc5d3d99 » LiNiO
2009-04-19 Formatter/YouTube.pm: Allow to embed youtube video player
9
10 $content = " youtube http://www.youtube.com/abc";
11 MojoMojo::Formatter::YouTube->format_content(\$content, $fake_c, undef);
12 #warn("Content is $content");
5fa0a0a3 » dandv
2009-04-22 Updated tests to use DummyCatalystObject instead of repeatedly defini…
13 is($content, " youtube http://www.youtube.com/abc\n", "no youtube formatter line");
fc5d3d99 » LiNiO
2009-04-19 Formatter/YouTube.pm: Allow to embed youtube video player
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");
5fa0a0a3 » dandv
2009-04-22 Updated tests to use DummyCatalystObject instead of repeatedly defini…
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));
fc5d3d99 » LiNiO
2009-04-19 Formatter/YouTube.pm: Allow to embed youtube video player
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");
5fa0a0a3 » dandv
2009-04-22 Updated tests to use DummyCatalystObject instead of repeatedly defini…
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));
fc5d3d99 » LiNiO
2009-04-19 Formatter/YouTube.pm: Allow to embed youtube video player
26
27 $content = "{{youtube http://wwwwwwww.youtube.com/abc}}";
28 MojoMojo::Formatter::YouTube->format_content(\$content, $fake_c, undef);
29 #warn("Content is $content");
5fa0a0a3 » dandv
2009-04-22 Updated tests to use DummyCatalystObject instead of repeatedly defini…
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");
fc5d3d99 » LiNiO
2009-04-19 Formatter/YouTube.pm: Allow to embed youtube video player
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.