Debian Codegraph @

t/lists.t

raw
1 #!perl
2
3 BEGIN { chdir 't' if -d 't' }
4
5 use strict;
6 use warnings;
7
8 use Test::More tests => 8;
9 use Test::NoWarnings;
10
11 use_ok 'Text::MediawikiFormat', as => 'wf', process_html => 0 or exit;
12 ok exists $Text::MediawikiFormat::tags{blockorder}, 'T:MF should have a blockorder entry in %tags';
13
14 # isan ARRAY
15 isa_ok $Text::MediawikiFormat::tags{blockorder}, 'ARRAY', '...and it should be an array';
16
17 like join( ' ', @{ $Text::MediawikiFormat::tags{blockorder} } ), qr/^code/, '...and code should come before everything';
18
19 my $wikitext = <<END_HERE;
20 * first list item
21 * second list item
22 * list item with a [[Wiki Link]]
23 END_HERE
24
25 my $htmltext = wf($wikitext);
26
27 like $htmltext, qr!<li>first list item!, 'lists should be able to start on the first line of text';
28 like $htmltext, qr!href='Wiki%20Link'!, 'list item content should be formatted';
29
30 ###
31 ### Dictionary Lists
32 ###
33 $wikitext = <<END_HERE;
34 ; Term 1 : definition 1.1
35 : definition 1.2
36 ; Term 2
37 : definition 2.1
38 : definition 2.2
39
40 : indented 1
41 : indented 2
42 END_HERE
43
44 $htmltext = wf($wikitext);
45
46 is $htmltext, '<dl>
47 <dt>Term 1</dt>
48 <dd>definition 1.1</dd>
49 <dd>definition 1.2</dd>
50 <dt>Term 2</dt>
51 <dd>definition 2.1</dd>
52 <dd>definition 2.2</dd>
53 </dl>
54 <dl>
55 <dd>indented 1</dd>
56 <dd>indented 2</dd>
57 </dl>
58 ', 'dictionary lists format correctly';