Lines 16-22
Link Here
|
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
use Test::More tests => 5; |
19 |
use Test::More tests => 6; |
20 |
use t::lib::QA::TemplateFilters; |
20 |
use t::lib::QA::TemplateFilters; |
21 |
|
21 |
|
22 |
subtest 'Asset must use raw' => sub { |
22 |
subtest 'Asset must use raw' => sub { |
Lines 260-262
INPUT
Link Here
|
260 |
@missing_filters = t::lib::QA::TemplateFilters::missing_filters($input); |
260 |
@missing_filters = t::lib::QA::TemplateFilters::missing_filters($input); |
261 |
is_deeply( \@missing_filters, [], 'html_entity is a valid filter for href' ); |
261 |
is_deeply( \@missing_filters, [], 'html_entity is a valid filter for href' ); |
262 |
}; |
262 |
}; |
263 |
- |
263 |
|
|
|
264 |
subtest 'Do not escape KohaDates output' => sub { |
265 |
plan tests => 2; |
266 |
my $input = <<INPUT; |
267 |
[% var | \$KohaDates %] |
268 |
[% var | \$KohaDates with_hours => 1 %] |
269 |
[% var | \$KohaDates | html %] |
270 |
[% var | \$KohaDates with_hours => 1 | html %] |
271 |
INPUT |
272 |
|
273 |
my $expected = <<EXPECTED; |
274 |
[% var | \$KohaDates %] |
275 |
[% var | \$KohaDates with_hours => 1 %] |
276 |
[% var | \$KohaDates %] |
277 |
[% var | \$KohaDates with_hours => 1 %] |
278 |
EXPECTED |
279 |
|
280 |
my $new_content = t::lib::QA::TemplateFilters::fix_filters($input); |
281 |
is( $new_content . "\n", $expected, ); |
282 |
|
283 |
|
284 |
my @missing_filters = t::lib::QA::TemplateFilters::missing_filters($input); |
285 |
is_deeply( |
286 |
\@missing_filters, |
287 |
[ |
288 |
{ |
289 |
error => "extra_filter_not_needed", |
290 |
line => "[% var | \$KohaDates | html %]", |
291 |
line_number => 3, |
292 |
}, |
293 |
{ |
294 |
error => "extra_filter_not_needed", |
295 |
line => "[% var | \$KohaDates with_hours => 1 | html %]", |
296 |
line_number => 4, |
297 |
} |
298 |
] |
299 |
); |
300 |
|
301 |
}; |