File Coverage

blib/lib/Moonshine/Bootstrap/Component/Button.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition 1 2 50.0
subroutine 5 5 100.0
pod n/a
total 21 22 95.4


line stmt bran cond sub pod time code
1             package Moonshine::Bootstrap::Component::Button;
2              
3 18     18   251680 use strict;
  18         47  
  18         983  
4 18     18   134 use warnings;
  18         53  
  18         1551  
5              
6 18     18   622 use Moonshine::Magic;
  18         130363  
  18         255  
7 18     18   17699 use Moonshine::Bootstrap::Component;
  18         60  
  18         847  
8              
9             extends 'Moonshine::Bootstrap::Component';
10              
11             has(
12             button_spec => sub {
13             {
14             tag => { default => 'button' },
15             switch => { default => 'default' },
16             switch_base => { default => 'btn btn-' },
17             type => { default => 'button' },
18             sizing_base => { default => 'btn-' },
19             };
20             }
21             );
22              
23             sub button {
24 98     98   27304 my ($self) = shift;
25              
26 98   50     788 my ( $base_args, $build_args ) = $self->validate_build(
27             {
28             params => $_[0] // {},
29             spec => $self->button_spec,
30             }
31             );
32 98         1245 return Moonshine::Element->new($base_args);
33             }
34              
35             1;
36              
37             __END__