Skip to content

Commit

Permalink
better link_to examples and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 10, 2012
1 parent 4fabfea commit 632e25e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@

3.66 2012-12-10
- Improved documentation.
- Improved tests.

3.65 2012-12-09
- Added upgrade method to Mojo::UserAgent::Transactor.
Expand Down
10 changes: 6 additions & 4 deletions lib/Mojolicious/Plugin/TagHelpers.pm
Expand Up @@ -331,7 +331,7 @@ Generate file input element.
%= text_field 'first_name'
%= submit_button
% end
%= form_for login => {foo => 'bar'} => (method => 'POST') => begin
%= form_for login => {format => 'txt'} => (method => 'POST') => begin
%= text_field 'first_name'
%= submit_button
% end
Expand All @@ -351,7 +351,7 @@ but not C<GET>, a C<method> attribute will be automatically added.
<input name="first_name" />
<input value="Ok" type="submit" />
</form>
<form action="/path/to/login/bar" method="POST">
<form action="/path/to/login.txt" method="POST">
<input name="first_name" />
<input value="Ok" type="submit" />
</form>
Expand Down Expand Up @@ -414,7 +414,8 @@ Generate portable script tag for C<Javascript> asset.
=head2 C<link_to>
%= link_to Home => 'index'
%= link_to index => {foo => 'bar'} => (class => 'links') => begin
%= link_to Home => 'index' => {format => 'txt'} => (class => 'links')
%= link_to index => {format => 'txt'} => (class => 'links') => begin
Home
% end
<%= link_to index => begin %>Home<% end %>
Expand All @@ -426,7 +427,8 @@ Generate portable link to route, path or URL, defaults to using the
capitalized link target as content.
<a href="/path/to/index">Home</a>
<a class="links" href="/path/to/index/bar">Home</a>
<a class="links" href="/path/to/index.txt">Home</a>
<a class="links" href="/path/to/index.txt">Home</a>
<a href="/path/to/index">Home</a>
<a href="/path/to/file">File</a>
<a href="http://mojolicio.us">Mojolicious</a>
Expand Down
3 changes: 3 additions & 0 deletions t/mojolicious/tag_helper_lite_app.t
Expand Up @@ -82,6 +82,7 @@ $t->get_ok('/links')->status_is(200)->content_is(<<EOF);
<a href="http://example.com/"><foo>Example</foo></a>
<a href="/links">Home</a>
<a href="/form/23" title="Foo">Foo</a>
<a href="/form/23" title="Foo">Foo</a>
EOF

# POST /links
Expand All @@ -91,6 +92,7 @@ $t->post_ok('/links')->status_is(200)->content_is(<<EOF);
<a href="http://example.com/"><foo>Example</foo></a>
<a href="/links">Home</a>
<a href="/form/23" title="Foo">Foo</a>
<a href="/form/23" title="Foo">Foo</a>
EOF

# GET /script
Expand Down Expand Up @@ -402,6 +404,7 @@ __DATA__
<%= link_to 'http://example.com/' => begin %><foo>Example</foo><% end %>
<%= link_to Home => 'links' %>
<%= link_to Foo => 'form', {test => 23}, title => 'Foo' %>
<%= link_to form => {test => 23} => (title => 'Foo') => begin %>Foo<% end %>
@@ script.html.ep
<%= javascript '/script.js' %>
Expand Down

0 comments on commit 632e25e

Please sign in to comment.