Bug 18665: Add test for HtmlTags.pm
This patch adds tests for the tt filter HtmlTags.pm To test: prove -v t/HtmlTags.t should pass Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
9c7761fe89
commit
05b3084031
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# This module tests the HtmlTag filter
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More tests => 4;
|
||||
|
||||
BEGIN { use_ok('Koha::Template::Plugin::HtmlTags'); }
|
||||
|
||||
my $filter = Koha::Template::Plugin::HtmlTags->new();
|
||||
ok ($filter, "new()");
|
||||
|
||||
|
||||
# Test simple tag
|
||||
my $expected = '<h1>TEST</h1>';
|
||||
my $created = $filter->filter('TEST','', {tag => 'h1'} );
|
||||
is( $created, $expected, "Testing simple tag works: $expected - $created");
|
||||
|
||||
# Test tag with attributes
|
||||
$expected = '<h1 class="MYCLASS" title="MYTITLE">TEST</h1>';
|
||||
$created = $filter->filter('TEST','', {tag => 'h1', attributes => 'class="MYCLASS" title="MYTITLE"'} );
|
||||
is($created, $expected, "Testing tag with attributes works: $expected - $created");
|
||||
Loading…
Reference in New Issue