| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use Test::More; |
| 4 |
|
| 5 |
# this tests to make sure that a display field can take a value |
| 6 |
{ |
| 7 |
package MyApp::Form::Test; |
| 8 |
use HTML::FormHandler::Moose; |
| 9 |
extends 'HTML::FormHandler'; |
| 10 |
|
| 11 |
has_field 'foo' => ( type => 'Display', label => undef, required => 0, noupdate => 1 ); |
| 12 |
has_field 'bar' => ( type => 'Text' ); |
| 13 |
|
| 14 |
} |
| 15 |
|
| 16 |
my $form = MyApp::Form::Test->new; |
| 17 |
ok( $form ); |
| 18 |
|
| 19 |
my $init_obj = { |
| 20 |
foo => 'some foo', |
| 21 |
bar => 'a bar', |
| 22 |
}; |
| 23 |
|
| 24 |
$form->process( init_object => $init_obj, params => {} ); |
| 25 |
is( $form->field('foo')->value, 'some foo', 'foo field has a value' ); |
| 26 |
|
| 27 |
my $rendered = $form->render; |
| 28 |
|
| 29 |
done_testing; |