Skip to content

Commit

Permalink
Add test for new parser (work in progress).
Browse files Browse the repository at this point in the history
  • Loading branch information
racke committed Oct 27, 2016
1 parent 3851712 commit 6c1887b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ t/filters/strip.t
t/filters/subs.t
t/filters/upper.t
t/values/append.t
t/values/append-libxml.t
t/values/bad_objects.t
t/values/basic.t
t/values/bom.t
Expand Down
16 changes: 15 additions & 1 deletion t/values/append-libxml.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,26 @@ $spec = q{<specification>

$html = q{<div class="test">FOO</div>};

use XML::LibXML;

my $libxml_parser = XML::LibXML->new;

my $doc = $libxml_parser->load_html(string => $html);

# find element with class "test"
for my $node ($doc->findnodes('//*[contains(concat(" ", normalize-space(@class), " "), " test ")]')) {
# append text
$node->appendText('BAR');
}

$out = $doc->toStringHTML;

$flute = Template::Flute->new(template => $html,
specification => $spec,
values => {test => 'BAR'},
);

$out = $flute->process;
#$out = $flute->process;

like ($out, qr%<div class="test">FOOBAR</div>%,
"value with op=append");
Expand Down

0 comments on commit 6c1887b

Please sign in to comment.