Lil clean-up again
This commit is contained in:
parent
ad00f26824
commit
846eaac58d
18
t/post.t
18
t/post.t
|
@ -9,27 +9,27 @@ use Test::Mojo;
|
|||
my $script = curfile->dirname->sibling('PostText.pl');
|
||||
my $t = Test::Mojo->new($script);
|
||||
my %valid_params = (
|
||||
author => 'Anonymous',
|
||||
title => 'hi',
|
||||
body => 'ayy... lmao'
|
||||
author => 'Anonymous',
|
||||
title => 'hi',
|
||||
body => 'ayy... lmao'
|
||||
);
|
||||
my %invalid_title = (
|
||||
author => 'Anonymous',
|
||||
title => '',
|
||||
body => 'ayy... lmao'
|
||||
title => '',
|
||||
body => 'ayy... lmao'
|
||||
);
|
||||
my %invalid_post = (
|
||||
author => 'Anonymous',
|
||||
title => 'hi',
|
||||
body => 'a'
|
||||
title => 'hi',
|
||||
body => 'a'
|
||||
);
|
||||
my %valid_remark = (
|
||||
author => 'Anonymous',
|
||||
body => 'hi'
|
||||
body => 'hi'
|
||||
);
|
||||
my %invalid_remark = (
|
||||
author => 'Anonymous',
|
||||
body => 'a'
|
||||
body => 'a'
|
||||
);
|
||||
|
||||
$t->ua->max_redirects(1);
|
||||
|
|
|
@ -9,6 +9,7 @@ use Test::Mojo;
|
|||
my $script = curfile->dirname->sibling('PostText.pl');
|
||||
my $t = Test::Mojo->new($script);
|
||||
|
||||
$t->get_ok('/thread/1')->status_is(200)->text_like(h2 => qr/Thread #1/);
|
||||
$t->get_ok('/thread/1' )->status_is(200)->text_like(h2 => qr/Thread #1/);
|
||||
$t->get_ok('/thread/1/1')->status_is(200)->text_like(h2 => qr/Thread #1/);
|
||||
|
||||
done_testing();
|
||||
|
|
|
@ -5,19 +5,19 @@
|
|||
<div class="author field">
|
||||
<%= label_for author => 'Author' %>
|
||||
<% if (my $previous_author = session->{'author'}) { =%>
|
||||
<%= text_field author => $previous_author, maxlength => 63, minlength => 1 %>
|
||||
<%= text_field author => $previous_author, maxlength => 63, minlength => 1 %>
|
||||
<% } else { =%>
|
||||
<%= text_field author => 'Anonymous', maxlength => 63, minlength => 1 %>
|
||||
<%= text_field author => 'Anonymous', maxlength => 63, minlength => 1 %>
|
||||
<% } =%>
|
||||
<% if (my $error = validation->error('author')) { =%>
|
||||
<p class="field-with-error">Invalid author: 1 to 63 characters please.</p>
|
||||
<p class="field-with-error">Invalid author: 1 to 63 characters please.</p>
|
||||
<% } =%>
|
||||
</div>
|
||||
<div class="title field">
|
||||
<%= label_for title => 'Title' %>
|
||||
<%= text_field 'title', maxlength => 127, minlength => 1 %>
|
||||
<% if (my $error = validation->error('title')) { =%>
|
||||
<p class="field-with-error">Invalid title: 1 to 127 characters please.</p>
|
||||
<p class="field-with-error">Invalid title: 1 to 127 characters please.</p>
|
||||
<% } =%>
|
||||
</div>
|
||||
<div class="text field">
|
||||
|
@ -29,7 +29,7 @@
|
|||
rows => 6
|
||||
) %>
|
||||
<% if (my $error = validation->error('body')) { =%>
|
||||
<p class="field-with-error">Invalid text: Up to 4,000 characters only.</p>
|
||||
<p class="field-with-error">Invalid text: Up to 4,000 characters only.</p>
|
||||
<% } =%>
|
||||
</div>
|
||||
<%= submit_button 'Post', class => 'post button' %>
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<div class="author field">
|
||||
<%= label_for author => 'Author' %>
|
||||
<% if (my $previous_author = session->{'author'}) { =%>
|
||||
<%= text_field author => $previous_author, maxlength => 63, minlength => 1 %>
|
||||
<%= text_field author => $previous_author, maxlength => 63, minlength => 1 %>
|
||||
<% } else { =%>
|
||||
<%= text_field author => 'Anonymous', maxlength => 63, minlength => 1 %>
|
||||
<%= text_field author => 'Anonymous', maxlength => 63, minlength => 1 %>
|
||||
<% } =%>
|
||||
<% if (my $error = validation->error('author')) { =%>
|
||||
<p class="field-with-error">Invalid author: 1 to 63 characters please.</p>
|
||||
|
|
Loading…
Reference in New Issue
Block a user