All of add_before, add_after and replace methods from
HTML::Zoom::FilterBuilder should accept anything zoom-able, like
e.g. string (to be turned into text element), not only naked events.
Currently $zoom->...->replace("foo") works, but neither
->add_before("foo") nor ->add_after("foo") do.
is(
run_for { $_->add_before($ohai) },
$expect,
- 'add_before ok'
+ 'add_before event ok'
+);
+is(
+ eval { run_for { $_->add_before('O HAI') } },
+ $expect,
+ 'add_before string ok'
);
($expect = $tmpl) =~ s/(?<=<\/div>)/O HAI/;
is(
run_for { $_->add_after($ohai) },
$expect,
- 'add_after ok'
+ 'add_after event ok'
+);
+is(
+ eval { run_for { $_->add_after('O HAI') } },
+ $expect,
+ 'add_after string ok'
);
($expect = $tmpl) =~ s/(?<=class="main">)/O HAI/;
'prepend_content ok with in place close'
);
-is(
- run_for { $_->replace($ohai) },
-'<body>
+$expect = <<'HTML';
+<body>
O HAI
</body>
-',
- 'replace ok'
+HTML
+is(
+ run_for { $_->replace($ohai) },
+ $expect,
+ 'replace event ok'
+);
+is(
+ run_for { $_->replace('O HAI') },
+ $expect,
+ 'replace string ok'
);
@ev = ();