File Coverage

blib/lib/Moonshine/Bootstrap/Component/ButtonToolbar.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::ButtonToolbar;
2              
3 5     5   294524 use Moonshine::Magic;
  5         160086  
  5         45  
4 5     5   3419 use Params::Validate qw/ARRAYREF/;
  5         31  
  5         474  
5              
6             extends(
7             'Moonshine::Bootstrap::Component',
8             'Moonshine::Bootstrap::Component::ButtonGroup',
9             );
10              
11             has(
12             button_toolbar_spec => sub {
13             {
14             tag => { default => 'div' },
15             role => { default => 'toolbar' },
16             class_base => { default => 'btn-toolbar' },
17             toolbar => {
18             type => ARRAYREF,
19             },
20             };
21             }
22             );
23              
24             sub button_toolbar {
25 3     3   8797 my ($self) = shift;
26              
27 3   50     26 my ( $base_args, $build_args ) = $self->validate_build(
28             {
29             params => $_[0] // {},
30             spec => $self->button_toolbar_spec,
31             }
32             );
33              
34 3         41 my $button_toolbar = Moonshine::Element->new($base_args);
35              
36 3         7208 for ( @{ $build_args->{toolbar} } ) {
  3         12  
37 6         103 $button_toolbar->add_child( $self->button_group($_) );
38             }
39              
40 3         81 return $button_toolbar;
41             }
42              
43             1;
44              
45             __END__