diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-10-08 13:33:45 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-10-08 13:33:45 -0500 |
commit | 6d3b76546c92f15aadc2a9c4b7568411e49ccfbe (patch) | |
tree | 99d12c1e4c9d73765fa9bc09320f896cdae50ca4 /t | |
parent | 7f47485c049416b1c4386d21531f1e50ae3acd79 (diff) | |
download | text-handlebars-6d3b76546c92f15aadc2a9c4b7568411e49ccfbe.tar.gz text-handlebars-6d3b76546c92f15aadc2a9c4b7568411e49ccfbe.zip |
implement hash parameters for block helpers
Diffstat (limited to 't')
-rw-r--r-- | t/block-helpers.t | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/t/block-helpers.t b/t/block-helpers.t index 4b68d1e..3cd6cb8 100644 --- a/t/block-helpers.t +++ b/t/block-helpers.t @@ -287,26 +287,25 @@ RENDERED "if/else helper (false)" ); -{ local $TODO = "unimplemented"; local $SIG{__WARN__} = sub { }; render_ok( { helpers => { list => sub { my ($context, $items, $options) = @_; - my $attrs = join ' ', map { $_ => $options->{hash}{$_} } + my $attrs = join ' ', map { "$_=\"$options->{hash}{$_}\"" } sort keys %{ $options->{hash} }; return "<ul $attrs>" . join("\n", map { "<li>" . $options->{fn}->($_) . "</li>" } @$items) - . "</ul>"; + . "</ul>\n"; }, }, }, <<'TEMPLATE', -{{list nav id="nav-bar" class="top"}} +{{#list nav id="nav-bar" class="top"}} <a href="{{url}}">{{title}}</a> {{/list}} TEMPLATE @@ -325,12 +324,13 @@ TEMPLATE <<'RENDERED', <ul class="top" id="nav-bar"><li> <a href="http://www.yehudakatz.com">Katz Got Your Tongue</a> </li> - <a href="http://www.sproutcore.com/block">SproutCore Blog</a> +<li> <a href="http://www.sproutcore.com/block">SproutCore Blog</a> </li></ul> RENDERED "helper arguments" ); +{ local $TODO = "unimplemented"; local $SIG{__WARN__} = sub { }; # XXX this is almost certainly not what the api should be like, but i don't # understand the purpose for this feature well enough to come up with anything # more reasonable. feedback welcome! |