File Coverage

blib/lib/Moonshine/Bootstrap/Component/Ul.pm
Criterion Covered Total %
statement 22 22 100.0
branch 4 4 100.0
condition 1 2 50.0
subroutine 6 6 100.0
pod n/a
total 33 34 97.0


line stmt bran cond sub pod time code
1             package Moonshine::Bootstrap::Component::Ul;
2              
3 5     5   209195 use strict;
  5         14  
  5         288  
4 5     5   38 use warnings;
  5         11  
  5         397  
5              
6 5     5   581 use Moonshine::Magic;
  5         141175  
  5         77  
7 5     5   3772 use Moonshine::Bootstrap::Component;
  5         27  
  5         209  
8 5     5   54 use Moonshine::Util;
  5         13  
  5         93  
9              
10             extends 'Moonshine::Bootstrap::Component';
11              
12             has(
13             ul_spec => sub {
14             {
15             tag => { default => 'ul' },
16             inline => 0,
17             unstyle => 0,
18             };
19             }
20             );
21              
22             sub ul {
23 4     4   20248 my $self = shift;
24 4   50     35 my ( $base_args, $build_args ) = $self->validate_build(
25             {
26             params => $_[0] // {},
27             spec => $self->ul_spec,
28             }
29             );
30              
31 4 100       40 if ( defined $build_args->{unstyle} ) {
32             $base_args->{class} =
33 2         13 append_str( 'list-unstyled', $base_args->{class} );
34             }
35              
36 4 100       27 if ( defined $build_args->{inline} ) {
37 2         12 $base_args->{class} = append_str( 'list-inline', $base_args->{class} );
38             }
39              
40 4         45 return Moonshine::Element->new($base_args);
41             }
42              
43             1;
44              
45             __END__