use strict; use warnings; use Test::More tests => 6; use HTML::Widget; use lib 't/lib'; use HTMLWidget::TestLib; my $w = HTML::Widget->new; my $e = $w->element( 'RadioGroup', 'bar' )->values( [ 'opt1', 'opt2', 'opt3' ] ) ->value('opt1'); # Without query { my $f = $w->process; is( "$f", <
EOF } # With mocked basic query { my $query = HTMLWidget::TestLib->mock_query( { bar => 'opt2' } ); my $f = $w->process($query); is( "$f", <
EOF } # With legend $e->legend('Select One'); { my $f = $w->process; is( "$f", <
Select One
EOF } # With label $e->legend(undef); $e->label('Choose'); { my $f = $w->process; is( "$f", <
Choose
EOF } # With comment too $e->comment('Informed'); { my $f = $w->process; is( "$f", <
ChooseInformed
EOF } # With error $w->constraint( 'In' => 'bar' )->in('octopus'); { my $query = HTMLWidget::TestLib->mock_query( { bar => 'opt2' } ); my $f = $w->process($query); is( "$f", <
ChooseInformed
Invalid Input
EOF }