blob: 08ad9c3f2c61e8ba0aed71b11d1a739cdbcd7260 (
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
32
33
34
35
36
37
38
|
use Test::Most 'die'; BEGIN { eval 'use HTML::Element'; plan skip_all => 'HTML::Element needed for this test' if $@; } plan tests => 1; use strict; use warnings; use Tree::Template::Declare 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'; attribs id => 'p1'; attribs class => 'para'; node { name '~text'; attribs text => 'Page para' }; }; }; }; }; is($tree->as_HTML(), qq{<html><head><title>Page title</title></head><body><p class="para" id="p1">Page para</body></html>\n}, 'HTML tree' );
|