blob: 28c770b85de7b290861dfc0b7fa042bb47b68289 [file] [log] [blame]
Akron4c33c622018-11-12 13:43:27 +01001use Mojo::Base -strict;
2use Test::More;
3use Test::Mojo;
4
5# Test the documentation
6my $t = Test::Mojo->new('Kalamar');
7
8$t->app->plugin('Piwik' => {
9 url => 'https://piwik.korap.ids-mannheim.de/',
10 site_id => 1,
11 embed => 1
12});
13
14# Load piwik
15$t->app->plugin('Kalamar::Plugin::Piwik');
16
17$t->get_ok('/doc/faq')
18 ->status_is(200)
19 ->text_like('section[name=piwik-opt-out] h3', qr!can I opt-out!)
20 ->element_exists('section[name=piwik-opt-out] iframe')
21 ->content_like(qr!var _paq!)
22 ->content_like(qr!window\.addEventListener\('korapRequest!)
23 ;
24
Akron7c758412018-11-13 14:17:00 +010025# No embedding
26$t->app->plugin('Piwik' => {
27 url => 'https://piwik.korap.ids-mannheim.de/',
28 site_id => 1,
29 embed => 0
30});
31
32$t->get_ok('/doc/faq')
33 ->status_is(200)
34 ->text_like('section[name=piwik-opt-out] h3', qr!can I opt-out!)
35 ->element_exists_not('section[name=piwik-opt-out] iframe')
36 ->content_unlike(qr!var _paq!)
37 ->content_unlike(qr!window\.addEventListener\('korapRequest!)
38 ;
39
40
Akron4c33c622018-11-12 13:43:27 +010041done_testing();