Lil clean-up again

This commit is contained in:
swag 2022-09-21 00:27:16 -04:00
parent ad00f26824
commit 846eaac58d
4 changed files with 18 additions and 17 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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' %>

View File

@ -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>