root/lang/perl/mobirc/trunk/t/Web/Template/Ajax/menu.t @ 13031

Revision 13031, 0.9 kB (checked in by tokuhirom, 6 years ago)

App::Mobirc::HTTPD::* => App::Mobirc::Web::*

Line 
1use strict;
2use warnings;
3use App::Mobirc::Web::View;
4use Test::More tests => 1;
5use HTTP::MobileAgent;
6use Text::Diff;
7use App::Mobirc;
8use App::Mobirc::Model::Server;
9use App::Mobirc::Util;
10
11# init.
12my $c = App::Mobirc->new(
13    {
14        httpd => { port => 3333, title => 'mobirc', lines => 40 },
15        global => { keywords => [qw/foo/], stopwords => [qw/foo31/] },
16    }
17);
18
19my $server = App::Mobirc::Model::Server->new();
20$server->get_channel(U '#tester');
21
22my $got = do {
23    local $_ = App::Mobirc::Web::View->show(
24        'ajax/menu',
25        server             => $server,
26        keyword_recent_num => 3
27    );
28    s/^\n//;
29    $_;
30};
31
32my $expected = do {
33    local $_ = <<'...';
34<div>
35 <div class="keyword_recent_notice">
36  <a href="#">Keyword&#40;3&#41;</a>
37 </div>
38 <div class="channel">
39  <a href="#">#tester</a>
40 </div>
41</div>
42...
43    s/\n$//;
44    $_;
45};
46
47ok !diff(\$got, \$expected), diff(\$got, \$expected, { STYLE => "Context" });
48
Note: See TracBrowser for help on using the browser.