Skip to content

Commit

Permalink
make sure content type is not affected by variants
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 13, 2014
1 parent ecd39c9 commit faf0c70
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

4.89 2014-03-12
4.89 2014-03-13
- Added support for template variants.
- Fixed bug in Mojo::DOM::HTML where non-self-closing elements were not
handled correctly.
Expand Down
27 changes: 15 additions & 12 deletions t/mojolicious/layouted_lite_app.t
Expand Up @@ -252,20 +252,23 @@ $t->get_ok('/data')->status_is(200)->header_is(Server => 'Mojolicious (Perl)')
->content_is(0);

# Variants (desktop)
$t->get_ok('/variants')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')->content_is('Variant: Desktop!');
$t->get_ok('/variants.txt')->status_is(200)
->content_type_is('text/plain;charset=UTF-8')
->content_is('Variant: Desktop!');

# Variants (tablet)
$t->get_ok('/variants?device=tablet')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')->content_is('Variant: Tablet!');
$t->get_ok('/variants.txt?device=tablet')->status_is(200)
->content_type_is('text/plain;charset=UTF-8')
->content_is('Variant: Tablet!');

# Variants (desktop fallback)
$t->get_ok('/variants?device=phone')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')->content_is('Variant: Desktop!');
$t->get_ok('/variants.txt?device=phone')->status_is(200)
->content_type_is('text/plain;charset=UTF-8')
->content_is('Variant: Desktop!');

# Variants ("0")
$t->get_ok('/variants?device=0')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')
$t->get_ok('/variants.txt?device=0')->status_is(200)
->content_type_is('text/plain;charset=UTF-8')
->content_is('Another variant: Desktop!');

done_testing();
Expand Down Expand Up @@ -399,14 +402,14 @@ to
<%= content_for 'message' %>
work!
@@ layouts/variants.html.ep
@@ layouts/variants.txt.ep
Variant: <%= content %>\
@@ layouts/variants.html+0.ep
@@ layouts/variants.txt+0.ep
Another variant: <%= content %>\
@@ variants.html.ep
@@ variants.txt.ep
Desktop!\
@@ variants.html+tablet.epl
@@ variants.txt+tablet.epl
Tablet!\

0 comments on commit faf0c70

Please sign in to comment.