File Coverage

blib/lib/Moonshine/Bootstrap/Component/LinkImage.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition 1 2 50.0
subroutine 3 3 100.0
pod n/a
total 15 16 93.7


line stmt bran cond sub pod time code
1             package Moonshine::Bootstrap::Component::LinkImage;
2              
3 11     11   228949 use Moonshine::Magic;
  11         112627  
  11         87  
4 11     11   7140 use Params::Validate qw/HASHREF/;
  11         27  
  11         894  
5              
6             lazy_components qw/a img/;
7              
8             extends 'Moonshine::Bootstrap::Component';
9              
10             has(
11             link_image_spec => sub {
12             {
13             img => { build => 1, type => HASHREF },
14             href => 1,
15             };
16             }
17             );
18              
19             sub link_image {
20 27     27   16714 my ($self) = shift;
21              
22 27   50     297 my ( $base_args, $build_args ) = $self->validate_build(
23             {
24             params => $_[0] // {},
25             spec => $self->link_image_spec,
26             }
27             );
28              
29 27         550 my $a = $self->a($base_args);
30 27         65528 $a->add_child( $self->img( $build_args->{img} ) );
31 27         70504 return $a;
32             }
33              
34             1;
35              
36             __END__