|
Revision 13031, 0.9 kB
(checked in by tokuhirom, 5 years ago)
|
|
App::Mobirc::HTTPD::* => App::Mobirc::Web::*
|
| Line | |
|---|
| 1 | use strict; |
|---|
| 2 | use warnings; |
|---|
| 3 | use App::Mobirc::Web::View; |
|---|
| 4 | use Test::More tests => 1; |
|---|
| 5 | use HTTP::MobileAgent; |
|---|
| 6 | use Text::Diff; |
|---|
| 7 | use App::Mobirc; |
|---|
| 8 | use App::Mobirc::Model::Server; |
|---|
| 9 | use App::Mobirc::Util; |
|---|
| 10 | |
|---|
| 11 | # init. |
|---|
| 12 | my $c = App::Mobirc->new( |
|---|
| 13 | { |
|---|
| 14 | httpd => { port => 3333, title => 'mobirc', lines => 40 }, |
|---|
| 15 | global => { keywords => [qw/foo/], stopwords => [qw/foo31/] }, |
|---|
| 16 | } |
|---|
| 17 | ); |
|---|
| 18 | |
|---|
| 19 | my $server = App::Mobirc::Model::Server->new(); |
|---|
| 20 | $server->get_channel(U '#tester'); |
|---|
| 21 | |
|---|
| 22 | my $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 | |
|---|
| 32 | my $expected = do { |
|---|
| 33 | local $_ = <<'...'; |
|---|
| 34 | <div> |
|---|
| 35 | <div class="keyword_recent_notice"> |
|---|
| 36 | <a href="#">Keyword(3)</a> |
|---|
| 37 | </div> |
|---|
| 38 | <div class="channel"> |
|---|
| 39 | <a href="#">#tester</a> |
|---|
| 40 | </div> |
|---|
| 41 | </div> |
|---|
| 42 | ... |
|---|
| 43 | s/\n$//; |
|---|
| 44 | $_; |
|---|
| 45 | }; |
|---|
| 46 | |
|---|
| 47 | ok !diff(\$got, \$expected), diff(\$got, \$expected, { STYLE => "Context" }); |
|---|
| 48 | |
|---|