use strict; use warnings; use Test::More tests => 9; use HTML::FormFu; my $form = HTML::FormFu->new({ tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } }); $form->load_config_file('t/elements/combobox.yml'); { $form->process; is( $form->get_element({ type => 'ComboBox' }), qq{
} ); } { $form->get_element({ type => 'ComboBox' })->default('one'); $form->process; is( $form->get_element({ type => 'ComboBox' }), qq{
} ); } { $form->get_element({ type => 'ComboBox' })->default('four'); $form->process; is( $form->get_element({ type => 'ComboBox' }), qq{
} ); } # valid select value { $form->process({ combo_select => 'one', combo_text => '', }); ok( $form->submitted_and_valid ); is( $form->param_value('combo'), 'one' ); } # valid text value { $form->process({ combo_select => '', combo_text => 'four', }); ok( $form->submitted_and_valid ); is( $form->param_value('combo'), 'four' ); } # valid - text is used in preference to select value { $form->process({ combo_select => 'one', combo_text => 'four', }); ok( $form->submitted_and_valid ); is( $form->param_value('combo'), 'four' ); }