use strict; use warnings; use Test::More tests => 5; use HTML::FormFu; my $form = HTML::FormFu->new( { tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } } ); my $field1 = $form->element('Checkboxgroup')->name('foo')->value(2) ->options( [ [ 1 => 'One' ], [ 2 => 'Two' ] ] ); # add element to test non-reversed labels my $field2 = $form->element('Checkboxgroup')->name('foo2') ->options( [ [ 'a' => 'A' ], [ 'b' => 'B' ] ] )->reverse_group(0); # add more elements to test accessor output $form->element('Checkboxgroup')->name('foo3')->options( [ { label => 'Ein', value => 1 }, { label => 'Zwei', value => 2, attributes => { class => 'foobar' } }, ] ); $form->element('Checkboxgroup')->name('bar')->values( [qw/ one two three /] ) ->value('two')->label('My Bar'); my $field1_xhtml = qq{
}; is( "$field1", $field1_xhtml, 'basic checkboxgroup' ); my $field2_xhtml = qq{}; is( "$field2", $field2_xhtml, 'checkboxgroup with reverse_group off' ); my $form_xhtml = <