another test
Simon Elliott [Fri, 20 May 2011 19:50:48 +0000 (20:50 +0100)]
t/dwim-autoload.t

index 2fc73de..8765a99 100644 (file)
@@ -342,4 +342,20 @@ sub code_stream (&) {
     'Hashref selectors on codestream';
 }
 
+{
+  ok my $dwim = HTML::Zoom
+  ->from_html(q[<ul><li class="foo" name="bar"></li><li class="bar"></li></ul>])
+  ->select('ul')->collect({ 
+  passthrough => 1,
+  filter => sub {
+      $_->set_attribute({
+        'li.foo' => [{ class => 'baz', name => 'moo', }],
+        'li.bar' => [ class => 'qux' ],
+      });
+    }
+  })->to_html;
+  is $dwim, '<ul><li class="baz" name="moo"></li><li class="qux"></li></ul>',
+    'Hashref selectors with hashref attributes on codestream';
+}
+
 done_testing;