some simple shorthand helpers.
[catagits/HTML-Zoom.git] / t / actions.t
index 6e1541b..c2df1df 100644 (file)
@@ -55,6 +55,14 @@ is(
   'set attribute on existing attribute'
 );
 
+($expect = $tmpl) =~ s/class="main"/class="foo"/;
+
+is(
+  run_for { $_->set_attr({ name => 'class', value => 'foo' }) },
+  $expect,
+  'set attribute on existing attribute (shorthand)'
+);
+
 ($expect = $tmpl) =~ s/class="main"/class="main" foo="bar"/;
 
 is(
@@ -71,6 +79,22 @@ is(
   'add attribute on existing attribute'
 );
 
+($expect = $tmpl) =~ s/class="main"/class="main foo"/;
+
+is(
+  run_for { $_->add_class('foo') },
+  $expect,
+  'add attribute on existing attribute (shorthand)'
+);
+
+($expect = $tmpl) =~ s/class="main"/class="main" id="foo"/;
+
+is(
+  run_for { $_->set_id('foo') },
+  $expect,
+  'set_id (shorthand)'
+);
+
 ($expect = $tmpl) =~ s/class="main"/class="main" foo="bar"/;
 
 is(