summaryrefslogtreecommitdiff
path: root/t/03-html.t
blob: 8504c907db07b1ca5fa63000c3417e365570c58c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!perl 
use Test::Most 'no_plan','die';
use strict;
use warnings;
use Tree::Template::Declare options => {builder => '+HTML_Element'};
use Data::Dumper;
 
my $tree=tree {
    node {
        name 'html';
        node {
            name 'head';
            node {
                name 'title';
                node { name '~text'; attribs text => 'Page title' };
            }
        };
        node {
            name 'body';
            node {
                name 'p';
                node { name '~text'; attribs text => 'Page para' };
            };
        };
    };
};
 
is($tree->as_HTML(),
   qq{<html><head><title>Page title</title></head><body><p>Page para</body></html>\n},
   'HTML tree'
);