File Coverage

lib/HTML/FormWidgets/ScrollingList.pm
Criterion Covered Total %
statement 23 23 100.0
branch 4 8 50.0
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 34 38 89.4


line stmt bran cond sub pod time code
1             package HTML::FormWidgets::ScrollingList;
2              
3 1     1   746 use strict;
  1         3  
  1         25  
4 1     1   5 use warnings;
  1         2  
  1         25  
5 1     1   5 use parent 'HTML::FormWidgets';
  1         2  
  1         5  
6              
7             __PACKAGE__->mk_accessors( qw( height labels values ) );
8              
9             sub init {
10 1     1 1 3    my ($self, $args) = @_;
11              
12 1         7    $self->class ( q(ifield) );
13 1         6    $self->height( 10 );
14 1         10    $self->labels( undef );
15 1         7    $self->values( [] );
16 1         7    return;
17             }
18              
19             sub render_field {
20 1     1 1 2    my ($self, $args) = @_;
21              
22 1 50       4    $self->class =~ m{ chzn-select }msx
23                   and $self->add_optional_js( q(chosen.js) );
24              
25 1 50       10    $args->{class } .= ($args->{class} ? q( ) : q()).$self->class;
26 1 50       7    $args->{labels } = $self->labels if ($self->labels);
27 1 50       9    $args->{onchange} = $self->onchange if ($self->onchange);
28 1         7    $args->{size } = $self->height;
29 1         6    $args->{values } = $self->values;
30              
31 1         7    return $self->hacc->scrolling_list( $args );
32             }
33              
34             1;
35              
36             # Local Variables:
37             # mode: perl
38             # tab-width: 3
39             # End:
40