File: 01basic-formconfig.t

package info (click to toggle)
libcatalyst-controller-html-formfu-perl 2.04-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 408 kB
  • sloc: perl: 960; makefile: 6
file content (49 lines) | stat: -rw-r--r-- 952 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use strict;
use warnings;

use Test::More tests => 12;

use lib 't/lib';
use Test::WWW::Mechanize::Catalyst 'TestApp';

my $mech = Test::WWW::Mechanize::Catalyst->new;

$mech->get_ok('http://localhost/basic/formconfig');

{
    # 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>');
}