X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fdwim-autoload.t;h=2fc73de7110627a115a9865e8350acdef69c45a9;hb=3c53c43950487cb2a92d0f49a8932c37867a6ba0;hp=caf77167de4cb10a0792e487a6308aa391536c84;hpb=f0ddc273d86f2229d0a20103206ccc7d82078289;p=catagits%2FHTML-Zoom.git diff --git a/t/dwim-autoload.t b/t/dwim-autoload.t index caf7716..2fc73de 100644 --- a/t/dwim-autoload.t +++ b/t/dwim-autoload.t @@ -304,4 +304,42 @@ sub code_stream (&) { 'Got correct from repeat_content'; } +{ + ok my $dwim = HTML::Zoom + ->from_html(q[]) + ->replace_content({ + 'li.foo' => ['foo'], + 'li.bar' => ['bar'], + })->to_html; + is $dwim, '', + 'Hashref selectors (via replace_content)'; +} + +{ + ok my $dwim = HTML::Zoom + ->from_html(q[]) + ->set_attribute({ + 'li.foo' => [ class => 'baz' ], + 'li.bar' => [ class => 'qux' ], + })->to_html; + is $dwim, '', + 'Hashref selectors (via set_attribute)'; +} + +{ + ok my $dwim = HTML::Zoom + ->from_html(q[]) + ->select('ul')->collect({ + passthrough => 1, + filter => sub { + $_->set_attribute({ + 'li.foo' => [ class => 'baz' ], + 'li.bar' => [ class => 'qux' ], + }); + } + })->to_html; + is $dwim, '', + 'Hashref selectors on codestream'; +} + done_testing;