blob: 9291d01c989297bb6981da50831947408671a928 [file] [log] [blame]
Akroncb5c1712021-01-26 18:01:04 +01001use Mojolicious;
2use Test::Mojo;
3use Test::More;
4
5my $app = Mojolicious->new;
6my $t = Test::Mojo->new($app);
7
8# Client notifications
9$app->plugin(Notifications => {
10 'Kalamar::Plugin::Notifications' => 1,
11 JSON => 1,
12 HTML => 1
13});
14
15my $c = $app->build_controller;
16
17is($c->notifications('Kalamar::Plugin::Notifications'), '');
18
19$c->notify(warn => 'Error');
20$c->notify('warn' => 20, 'Hmmm');
21$c->notify('success' => {src => 'Kustvakt'}, 'Hmmm');
22
23my $n = $c->notifications('Kalamar::Plugin::Notifications');
24
25like($n, qr!^<div id="notifications">.*</div>$!s);
26like($n, qr!<div class="notify notify-warn" data-type="warn">Error</div>!);
27like($n, qr!<div class="notify notify-warn" data-type="warn">Hmmm</div>!);
28like($n, qr!<div class="notify notify-success" data-type="success" data-src="Kustvakt">Hmmm</div>!);
29
30done_testing;
31__END__