Skip to content

Commit

Permalink
better tests for tag helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 26, 2013
1 parent dada154 commit 1e5b7d1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

4.59 2013-11-24
4.59 2013-11-26

4.58 2013-11-19
- Improved IIS and WebSphere compatibility of Mojo::Message::Request.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Plugin/TagHelpers.pm
Expand Up @@ -639,7 +639,7 @@ Alias for L</"tag">.
% end
<%= tag div => (id => 'foo') => begin %>some & content<% end %>
HTML tag generator.
HTML/XML tag generator.
<div />
<div id="foo" />
Expand Down
17 changes: 17 additions & 0 deletions t/mojolicious/tag_helper_lite_app.t
Expand Up @@ -15,6 +15,8 @@ patch 'more_tags';

get 'small_tags';

get 'circle';

get 'tags_with_error';

any [qw(GET POST)] => 'links';
Expand Down Expand Up @@ -62,6 +64,13 @@ $t->get_ok('/small_tags')->status_is(200)->content_is(<<EOF);
<div>works</div>
EOF

# XML
$t->get_ok('/circle.svg')->status_is(200)->content_is(<<EOF);
<svg>
<circle cx="75" cy="55" fill="red" r="35" stroke="black" stroke-width="2" />
</svg>
EOF

# Tags with error
$t->get_ok('/tags_with_error')->status_is(200)->content_is(<<EOF);
<bar class="field-with-error">0</bar>
Expand Down Expand Up @@ -460,6 +469,14 @@ __DATA__
0
%= end
@@ circle.svg.ep
%= tag svg => begin
<%=
tag 'circle', cx => 75, cy => 55, r => 35, stroke => 'black',
'stroke-width' => 2, fill => 'red'
%>
%= end
@@ links.html.ep
<%= link_to 'Pa<th' => '/path' %>
<%= link_to 'http://example.com/', title => 'Foo', sub { 'Foo' } %>
Expand Down

0 comments on commit 1e5b7d1

Please sign in to comment.