Akron | 4c33c62 | 2018-11-12 13:43:27 +0100 | [diff] [blame] | 1 | use Mojo::Base -strict; |
| 2 | use Test::More; |
| 3 | use Test::Mojo; |
| 4 | |
| 5 | # Test the documentation |
| 6 | my $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 | |
Akron | 7c75841 | 2018-11-13 14:17:00 +0100 | [diff] [blame^] | 25 | # 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 | |
Akron | 4c33c62 | 2018-11-12 13:43:27 +0100 | [diff] [blame] | 41 | done_testing(); |