Make notifications framework CSP compliant
Change-Id: I95411f646053d76219908b91e9f0921c17280c28
diff --git a/t/plugin/notifications.t b/t/plugin/notifications.t
new file mode 100644
index 0000000..9291d01
--- /dev/null
+++ b/t/plugin/notifications.t
@@ -0,0 +1,31 @@
+use Mojolicious;
+use Test::Mojo;
+use Test::More;
+
+my $app = Mojolicious->new;
+my $t = Test::Mojo->new($app);
+
+# Client notifications
+$app->plugin(Notifications => {
+ 'Kalamar::Plugin::Notifications' => 1,
+ JSON => 1,
+ HTML => 1
+});
+
+my $c = $app->build_controller;
+
+is($c->notifications('Kalamar::Plugin::Notifications'), '');
+
+$c->notify(warn => 'Error');
+$c->notify('warn' => 20, 'Hmmm');
+$c->notify('success' => {src => 'Kustvakt'}, 'Hmmm');
+
+my $n = $c->notifications('Kalamar::Plugin::Notifications');
+
+like($n, qr!^<div id="notifications">.*</div>$!s);
+like($n, qr!<div class="notify notify-warn" data-type="warn">Error</div>!);
+like($n, qr!<div class="notify notify-warn" data-type="warn">Hmmm</div>!);
+like($n, qr!<div class="notify notify-success" data-type="success" data-src="Kustvakt">Hmmm</div>!);
+
+done_testing;
+__END__