| package Kalamar::Plugin::Test; |
| use Mojo::Base 'Mojolicious::Plugin'; |
| my ($plugin, $app, $param) = @_; |
| # Add entry to settings navigation |
| $app->navi->add(settings => ( |
| 'OAuth Token Management', 'oauth' |
| $app->routes->get('/settings/oauth')->to( |
| $c->content_with(settings => '<p id="abc">My Settings</p>'); |
| return $c->render('settings'); |
| use Mojo::ByteStream 'b'; |
| my $t = Test::Mojo->new('Kalamar' => { |
| ->text_is('a[href*=/settings/oauth]','OAuth Token Management') |
| ->text_is('h1 span', 'Settings') |
| $t->get_ok('/settings/oauth') |
| ->text_is('a[href*=/settings/oauth]','OAuth Token Management') |
| ->text_is('h1 span', 'Settings') |
| ->text_is('p#abc', 'My Settings') |