Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove writeonly flag from Display field, so that it can hold item va…
…lues
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
|
||
# this tests to make sure that a display field can take a value | ||
{ | ||
package MyApp::Form::Test; | ||
use HTML::FormHandler::Moose; | ||
extends 'HTML::FormHandler'; | ||
|
||
has_field 'foo' => ( type => 'Display', label => undef, required => 0, noupdate => 1 ); | ||
has_field 'bar' => ( type => 'Text' ); | ||
|
||
} | ||
|
||
my $form = MyApp::Form::Test->new; | ||
ok( $form ); | ||
|
||
my $init_obj = { | ||
foo => 'some foo', | ||
bar => 'a bar', | ||
}; | ||
|
||
$form->process( init_object => $init_obj, params => {} ); | ||
is( $form->field('foo')->value, 'some foo', 'foo field has a value' ); | ||
|
||
my $rendered = $form->render; | ||
|
||
done_testing; |