use strict;
use Test::More tests => 8;
BEGIN {
use_ok( 'Text::Trac' );
}
###############################################################################
instantiation: {
my $trac = Text::Trac->new();
isa_ok( $trac, 'Text::Trac' );
}
###############################################################################
ul_node_single_space: {
my $trac = Text::Trac->new();
my $text = qq{
* indent with
* single space
* sublist with
* two spaces
};
my $expect = qq{<ul><li>indent with</li>
<li>single space</li>
<ul><li>sublist with</li>
<li>two spaces</li></ul></ul>};
my $html = $trac->parse( $text );
is( $trac->html, $expect, 'UL node, single space indentation' );
}
###############################################################################
ul_node_double_space: {
my $trac = Text::Trac->new();
my $text = qq{
* indent with
* two spaces
* sublist with
* two spaces
};
my $expect = qq{<ul><li>indent with</li>
<li>two spaces</li>
<ul><li>sublist with</li>
<li>two spaces</li></ul></ul>};
my $html = $trac->parse( $text );
is( $trac->html, $expect, 'UL node, double space indentation' );
}
###############################################################################
ol_node_single_space: {
my $trac = Text::Trac->new();
my $text = qq{
1. indent with
1. single space
a. sublist with
a. two spaces
};
my $expect = qq{<ol start="1"><li>indent with</li>
<li>single space</li>
<ol class="loweralpha"><li>sublist with</li>
<li>two spaces</li></ol></ol>};
my $html = $trac->parse( $text );
is( $trac->html, $expect, 'OL node, single space indentation' );
}
###############################################################################
ol_node_double_space: {
my $trac = Text::Trac->new();
my $text = qq{
1. indent with
1. two spaces
a. sublist with
a. two spaces
};
my $expect = qq{<ol start="1"><li>indent with</li>
<li>two spaces</li>
<ol class="loweralpha"><li>sublist with</li>
<li>two spaces</li></ol></ol>};
my $html = $trac->parse( $text );
is( $trac->html, $expect, 'OL node, double space indentation' );
}
###############################################################################
dl_node_single_space: {
my $trac = Text::Trac->new();
my $text = qq{
title1::
indent title
single space
title2::
indent content
double space
};
my $expect = qq{<dl>
<dt>title1</dt>
<dd>
indent title
single space
</dd>
<dt>title2</dt>
<dd>
indent content
double space
</dd>
</dl>};
my $html = $trac->parse( $text );
is( $trac->html, $expect, 'DL node, single space indentation' );
}
###############################################################################
dl_node_double_space: {
my $trac = Text::Trac->new();
my $text = qq{
title1::
indent title
double space
title2::
indent content
double space
};
my $expect = qq{<dl>
<dt>title1</dt>
<dd>
indent title
double space
</dd>
<dt>title2</dt>
<dd>
indent content
double space
</dd>
</dl>};
my $html = $trac->parse( $text );
is( $trac->html, $expect, 'DL node, double space indentation' );
}