[Bps-public-commit] r11300 - in WebChart: lib/WebChart/Renderer

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Mar 31 10:44:51 EDT 2008


Author: sunnavy
Date: Mon Mar 31 10:44:44 2008
New Revision: 11300

Modified:
   WebChart/lib/WebChart/Renderer/PlotKit.pm
   WebChart/t/plotkit.t

Log:
make id in plotkit the same format as the filenames in other renderers

Modified: WebChart/lib/WebChart/Renderer/PlotKit.pm
==============================================================================
--- WebChart/lib/WebChart/Renderer/PlotKit.pm	(original)
+++ WebChart/lib/WebChart/Renderer/PlotKit.pm	Mon Mar 31 10:44:44 2008
@@ -39,7 +39,7 @@
     $self->_transform_data( \%args );
 
     my $r  = String::Random->new;
-    my $id = $r->randregex('\d{6}');
+    my $id = $r->randregex('wc_\w{6}');
     my $div;
     $div = qq[<div><canvas id="$id"];
     $div .= qq[ class="$args{web_css_class}"] if $args{web_css_class};

Modified: WebChart/t/plotkit.t
==============================================================================
--- WebChart/t/plotkit.t	(original)
+++ WebChart/t/plotkit.t	Mon Mar 31 10:44:44 2008
@@ -18,8 +18,8 @@
     type => 'bars',
     data => $data,
 );
-
-like( $id,  qr/^\d{6}$/,  'id is a number with 6 digits' );
+like( $id, qr/^wc_\w{6}$/,
+    'id is "wc_" followed by a string with length 6' );
 like( $seg, qr/id="$id"/, '$seg contains correct $id' );
 
 like( $seg, qr{src="/js/plotkit/}, 'default js dir is /js' );
@@ -35,32 +35,20 @@
 like( $seg, qr{height="300"}, 'default height is 300' );
 
 $seg = $renderer->render(
-    type        => 'bars',
-    data        => $data,
-    width       => 800,
-    height      => 600,
-    web_js_dir => '/jsjsjs',
+    type          => 'bars',
+    data          => $data,
+    width         => 800,
+    height        => 600,
+    web_js_dir    => '/jsjsjs',
     web_css_class => 'foo bar',
 );
 
 like( $seg, qr{src="/jsjsjs/plotkit/}, 'web_js_dir works' );
-like(
-    $seg,
-    qr{width="800"},
-    'set width works'
-);
+like( $seg, qr{width="800"},           'set width works' );
 
-like(
-    $seg,
-    qr{height="600"},
-    'set height works'
-);
+like( $seg, qr{height="600"}, 'set height works' );
 
-like(
-    $seg,
-    qr{class="foo bar"},
-    'set web_css_class works'
-);
+like( $seg, qr{class="foo bar"}, 'set web_css_class works' );
 
 ## Pie
 #
@@ -68,4 +56,4 @@
     type => 'pie',
     data => $data,
 );
-like ( $seg, qr/"pie"/, "pie type" );
+like( $seg, qr/"pie"/, "pie type" );



More information about the Bps-public-commit mailing list