--- trunk/t/30-Frey-jQuery-flot.t 2008/12/16 14:28:03 860 +++ trunk/t/30-Frey-jQuery-flot.t 2009/01/05 20:30:53 921 @@ -4,7 +4,7 @@ my $debug = @ARGV ? 1 : 0; -use Test::More tests => 4; +use Test::More tests => 7; use lib 'lib'; use Data::Dump qw/dump/; @@ -13,8 +13,28 @@ use_ok('Frey::jQuery::flot'); } -ok( my $o = Frey::jQuery::flot->new( request_url => '/', debug => $debug ), 'new' ); +my $param = { + request_url => '/', + debug => $debug, +}; + +ok( my $o = Frey::jQuery::flot->new( %$param, + sponge => { + rows => [ [ '2009-01-05' ] ], + NAME => [ 'foo' ], + }, +), 'new' ); ok( my $markup = $o->as_markup, 'as_markup' ); diag $markup if $debug; like( $markup, qr/\.plot/, 'markup content' ); +ok( my $invalid = Frey::jQuery::flot->new( %$param, + sponge => { + rows => [ [ 0 ] ], + NAME => [ 'invalid' ], + }, +), 'new with invalid time' ); +eval { $invalid->as_markup }; +ok( $@, 'died' ); +like( $@, qr/time/, 'invalid time' ); +