3746d2c8c24e47c5741a37c274e3713c07de8462
[koha.git] / t / HtmlTags.t
1 #!/usr/bin/perl
2 #
3 # This module tests the HtmlTag filter
4 #
5
6 use strict;
7 use warnings;
8
9 use Test::More tests => 4;
10
11 BEGIN { use_ok('Koha::Template::Plugin::HtmlTags'); }
12
13 my $filter = Koha::Template::Plugin::HtmlTags->new();
14 ok ($filter, "new()");
15
16
17 # Test simple tag
18 my $expected = '<h1>TEST</h1>';
19 my $created = $filter->filter('TEST','', {tag => 'h1'} );
20 is( $created, $expected, "Testing simple tag works: $expected - $created");
21
22 # Test tag with attributes
23 $expected = '<h1 class="MYCLASS" title="MYTITLE">TEST</h1>';
24 $created = $filter->filter('TEST','', {tag => 'h1', attributes => 'class="MYCLASS" title="MYTITLE"'} );
25 is($created, $expected, "Testing tag with attributes works: $expected - $created");