| Marc Kupietz | 08095ef | 2026-08-10 11:52:03 +0200 | [diff] [blame] | 1 | use Mojo::Base -strict; |
| 2 | use Test::More; |
| 3 | use Test::Mojo; |
| 4 | use Mojo::File qw/curfile/; |
| 5 | |
| 6 | my $t = Test::Mojo->new('Kalamar'); |
| 7 | push @{$t->app->renderer->paths}, curfile->dirname; |
| 8 | |
| 9 | my $c = $t->app->build_controller; |
| 10 | |
| 11 | # By default all three shipped parts are used; Kalamar ships no corpus, so |
| 12 | # the corpus part is a placeholder. |
| 13 | my $default = $c->include('partial/citation'); |
| 14 | like($default, qr/Under Construction/, 'corpus part is a placeholder by default'); |
| 15 | like($default, qr/KorAP architecture/, 'korap part is shipped'); |
| 16 | like($default, qr/MaltParser/, 'annotation part is shipped'); |
| 17 | |
| 18 | # Each part can be replaced by an instance template. |
| 19 | my $custom = $c->include('partial/citation', |
| 20 | corpus_citation => 'custom/partial/citation/corpus'); |
| 21 | like($custom, qr/The Example Corpus/, 'corpus part replaced by the instance template'); |
| 22 | unlike($custom, qr/Under Construction/, 'placeholder no longer rendered'); |
| 23 | like($custom, qr/KorAP architecture/, 'korap part still inherited'); |
| 24 | like($custom, qr/MaltParser/, 'annotation part still inherited'); |
| 25 | |
| 26 | done_testing; |