summaryrefslogtreecommitdiff
path: root/t/03-html.t
diff options
context:
space:
mode:
Diffstat (limited to 't/03-html.t')
-rw-r--r--t/03-html.t47
1 files changed, 47 insertions, 0 deletions
diff --git a/t/03-html.t b/t/03-html.t
new file mode 100644
index 0000000..6c1348d
--- /dev/null
+++ b/t/03-html.t
@@ -0,0 +1,47 @@
+#!perl
+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';
+ text_node 'Page title';
+ }
+ };
+ node {
+ name 'body';
+ node {
+ name 'p';
+ attribs id => 'p1';
+ attribs class => 'para';
+ text_node 'Page para';
+ };
+ };
+ };
+};
+
+my $expected_tree = HTML::Element->new_from_lol(
+ ['html',
+ ['head',
+ ['title','Page title'],
+ ],
+ ['body',
+ ['p','Page para',{class=>'para',id=>'p1'}],
+ ],
+ ],
+);
+ok($tree->same_as($expected_tree),
+ 'HTML tree'
+);