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 $script = curfile->dirname->sibling('PostText.pl');
my $t = Test::Mojo->new($script); my $t = Test::Mojo->new($script);
my %valid_params = ( my %valid_params = (
author => 'Anonymous', author => 'Anonymous',
title => 'hi', title => 'hi',
body => 'ayy... lmao' body => 'ayy... lmao'
); );
my %invalid_title = ( my %invalid_title = (
author => 'Anonymous', author => 'Anonymous',
title => '', title => '',
body => 'ayy... lmao' body => 'ayy... lmao'
); );
my %invalid_post = ( my %invalid_post = (
author => 'Anonymous', author => 'Anonymous',
title => 'hi', title => 'hi',
body => 'a' body => 'a'
); );
my %valid_remark = ( my %valid_remark = (
author => 'Anonymous', author => 'Anonymous',
body => 'hi' body => 'hi'
); );
my %invalid_remark = ( my %invalid_remark = (
author => 'Anonymous', author => 'Anonymous',
body => 'a' body => 'a'
); );
$t->ua->max_redirects(1); $t->ua->max_redirects(1);

View File

@ -9,6 +9,7 @@ use Test::Mojo;
my $script = curfile->dirname->sibling('PostText.pl'); my $script = curfile->dirname->sibling('PostText.pl');
my $t = Test::Mojo->new($script); 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(); done_testing();

View File

@ -5,19 +5,19 @@
<div class="author field"> <div class="author field">
<%= label_for author => 'Author' %> <%= label_for author => 'Author' %>
<% if (my $previous_author = session->{'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 { =%> <% } else { =%>
<%= text_field author => 'Anonymous', maxlength => 63, minlength => 1 %> <%= text_field author => 'Anonymous', maxlength => 63, minlength => 1 %>
<% } =%> <% } =%>
<% if (my $error = validation->error('author')) { =%> <% 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>
<div class="title field"> <div class="title field">
<%= label_for title => 'Title' %> <%= label_for title => 'Title' %>
<%= text_field 'title', maxlength => 127, minlength => 1 %> <%= text_field 'title', maxlength => 127, minlength => 1 %>
<% if (my $error = validation->error('title')) { =%> <% 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>
<div class="text field"> <div class="text field">
@ -29,7 +29,7 @@
rows => 6 rows => 6
) %> ) %>
<% if (my $error = validation->error('body')) { =%> <% 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> </div>
<%= submit_button 'Post', class => 'post button' %> <%= submit_button 'Post', class => 'post button' %>

View File

@ -5,9 +5,9 @@
<div class="author field"> <div class="author field">
<%= label_for author => 'Author' %> <%= label_for author => 'Author' %>
<% if (my $previous_author = session->{'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 { =%> <% } else { =%>
<%= text_field author => 'Anonymous', maxlength => 63, minlength => 1 %> <%= text_field author => 'Anonymous', maxlength => 63, minlength => 1 %>
<% } =%> <% } =%>
<% if (my $error = validation->error('author')) { =%> <% 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>