File Coverage

blib/lib/Moonshine/Bootstrap/Component/NavbarTextLink.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition 1 2 50.0
subroutine 3 3 100.0
pod n/a
total 16 17 94.1


line stmt bran cond sub pod time code
1             package Moonshine::Bootstrap::Component::NavbarTextLink;
2              
3 7     7   196683 use Moonshine::Magic;
  7         131325  
  7         58  
4 7     7   4356 use Params::Validate qw/HASHREF/;
  7         33  
  7         582  
5             lazy_components('a');
6              
7             extends (
8             'Moonshine::Bootstrap::Component',
9             'Moonshine::Bootstrap::Component::NavbarText',
10             );
11              
12             has(
13             navbar_text_link_spec => sub {
14             {
15             tag => { default => 'p' },
16             link => { type => HASHREF },
17             alignment => { base => 1, optional => 1 },
18             data => 1,
19             };
20             }
21             );
22              
23             sub navbar_text_link {
24 17     17   30226 my ($self) = shift;
25              
26 17   50     180 my ( $base_args, $build_args ) = $self->validate_build(
27             {
28             params => $_[0] // {},
29             spec => $self->navbar_text_link_spec,
30             }
31             );
32              
33 17         276 my $base_element = $self->navbar_text($base_args);
34              
35             $base_element->add_child(
36 17         45948 $self->a( { %{ $build_args->{link} }, class => 'navbar-link' } )
  17         231  
37             );
38              
39 17         44563 return $base_element;
40             }
41              
42             1;
43              
44             __END__