use strict; use warnings; use Test::More tests => 6; use HTML::Widget; use lib 't/lib'; use HTMLWidget::TestLib; my $w = HTML::Widget->new; $w->element( 'Select', 'foo' )->label('Foo') ->options( foo => 'Foo', bar => 'Bar' )->selected('foo'); $w->element( 'Select', 'bar' )->options( 23 => 'Baz', yada => 'Yada' ); $w->element( 'Select', 'stool' )->options( 1 => 'one', 2 => 'two' )->size(2); $w->element( 'Select', 'pigeon' )->options( 3 => 'three', 4 => 'four' ) ->multiple(1)->selected('4'); $w->constraint( 'Integer', 'foo' ); $w->constraint( 'Integer', 'stool' ); # Without query { my $f = $w->process; is( "$f", <
EOF } # With mocked basic query { my $query = HTMLWidget::TestLib->mock_query( { foo => 'foo', bar => [ 'yada', 23 ], stool => 2, pigeon => [ 3, 4 ], } ); my $f = $w->process($query); ok( !$f->valid('foo') ); ok( !$f->valid('bar') ); ok( $f->valid('stool') ); ok( $f->valid('pigeon') ); is( "$f", <
Invalid InputMultiple Selections Not Allowed
EOF }