File Coverage

blib/lib/Moonshine/Bootstrap/Component/ListedGroup.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition 1 2 50.0
subroutine 3 3 100.0
pod n/a
total 17 18 94.4


line stmt bran cond sub pod time code
1             package Moonshine::Bootstrap::Component::ListedGroup;
2              
3 5     5   134403 use Moonshine::Magic;
  5         98057  
  5         43  
4 5     5   2660 use Params::Validate qw/ARRAYREF/;
  5         9  
  5         342  
5              
6             extends (
7             'Moonshine::Bootstrap::Component',
8             'Moonshine::Bootstrap::Component::ListedGroupItem',
9             );
10              
11             has(
12             listed_group_spec => sub {
13             {
14             tag => { default => 'div' },
15             class_base => { default => 'list-group' },
16             list_items => { type => ARRAYREF, default => [ ] },
17             };
18             }
19             );
20              
21             sub listed_group {
22 7     7   41010 my ($self) = shift;
23              
24 7   50     61 my ( $base_args, $build_args ) = $self->validate_build(
25             {
26             params => $_[0] // {},
27             spec => $self->listed_group_spec,
28             }
29             );
30              
31 7         155 my $base_element = Moonshine::Element->new($base_args);
32              
33 7         15437 for ( @{ $build_args->{list_items} } ) {
  7         26  
34 7         48 $base_element->add_child($self->listed_group_item($_));
35             }
36              
37 7         790 return $base_element;
38             }
39              
40             1;
41              
42             __END__