File Coverage

blib/lib/Data/HTML/Element/Select.pm
Criterion Covered Total %
statement 36 36 100.0
branch 8 8 100.0
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 51 52 98.0


line stmt bran cond sub pod time code
1             package Data::HTML::Element::Select;
2              
3 16     16   228588 use strict;
  16         38  
  16         596  
4 16     16   79 use warnings;
  16         33  
  16         1129  
5              
6 16     16   8626 use Data::HTML::Element::Utils qw(check_data check_data_type);
  16         66  
  16         397  
7 16     16   9849 use Mo qw(build default is);
  16         11989  
  16         88  
8 16     16   45035 use Mo::utils 0.26 qw(check_bool check_number);
  16         330  
  16         1187  
9 16     16   9154 use Mo::utils::CSS 0.02 qw(check_css_class);
  16         181558  
  16         452  
10              
11             our $VERSION = 0.17;
12              
13             has autofocus => (
14             is => 'ro',
15             );
16              
17             has css_class => (
18             is => 'ro',
19             );
20              
21             has data => (
22             default => [],
23             ro => 1,
24             );
25              
26             has data_type => (
27             ro => 1,
28             );
29              
30             has disabled => (
31             is => 'ro',
32             );
33              
34             has form => (
35             is => 'ro',
36             );
37              
38             has id => (
39             is => 'ro',
40             );
41              
42             has label => (
43             is => 'ro',
44             );
45              
46             has multiple => (
47             is => 'ro',
48             );
49              
50             has name => (
51             is => 'ro',
52             );
53              
54             has onchange => (
55             is => 'ro',
56             );
57              
58             has required => (
59             is => 'ro',
60             );
61              
62             has size => (
63             is => 'ro',
64             );
65              
66             sub BUILD {
67 44     44 0 5140216 my $self = shift;
68              
69             # Check autofocus.
70 44 100       259 if (! defined $self->{'autofocus'}) {
71 40         128 $self->{'autofocus'} = 0;
72             }
73 44         234 check_bool($self, 'autofocus');
74              
75             # Check CSS class.
76 43         1134 check_css_class($self, 'css_class');
77              
78             # Check data type.
79 42         668 check_data_type($self);
80              
81             # Check data based on type.
82 41         154 check_data($self);
83              
84             # Check disabled.
85 38 100       120 if (! defined $self->{'disabled'}) {
86 34         94 $self->{'disabled'} = 0;
87             }
88 38         121 check_bool($self, 'disabled');
89              
90             # Check multiple.
91 37 100       634 if (! defined $self->{'multiple'}) {
92 35         96 $self->{'multiple'} = 0;
93             }
94 37         111 check_bool($self, 'multiple');
95              
96             # Check required.
97 36 100       531 if (! defined $self->{'required'}) {
98 32         82 $self->{'required'} = 0;
99             }
100 36         116 check_bool($self, 'required');
101              
102             # Check size.
103 35         1033 check_number($self, 'size');
104              
105 34         388 return;
106             }
107              
108             1;
109              
110             __END__