The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

use strict;
use Test::More tests => 12;
use lib 't/lib';
my $mech = Test::WWW::Mechanize::Catalyst->new;
{
# test __uri_for()__ set in config file
like( $mech->response->content, qr{<label>[^<]+/uri_for</label>} );
}
my ($form) = $mech->forms;
ok($form);
ok( $form->find_input('basic_formconfig') );
my $uri = $form->action;
{
$mech->post_ok( $uri, { unknown_field => 'foo' } );
$mech->content_contains('<p>not submitted, render</p>');
}
{
$mech->post_ok( $uri, { submit => 'foo' } );
$mech->content_contains('<p>submitted, not valid, render</p>');
}
{
$mech->post_ok( $uri, { basic_formconfig => '' } );
$mech->content_contains('<p>submitted, not valid, render</p>');
}
{
$mech->post_ok( $uri, { basic_formconfig => 'foo' } );
$mech->content_contains('<p>submitted, valid</p>');
}