NavMenu/Iterator/JQTreeView.pm

filter: Statementstmt 91.8% 34 / 37 Branchbran 100% 4 / 4 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 90.0% 9 / 10 Podpod n/a totaltotal 86.8% 53 / 61 CC 5 SCAR 5.8
CC
5
Cov
89%
_start_handle_non_role
3.0
_calc_open_li_tag
2.0
_is_expanded_for_treeview
2.0
CRAP 1.8
« NavMenu/Tree/Iterator/Item.pm ↑ Summary NavMenu/Iterator/NavMenu.pm »
1 package HTML::Widgets::NavMenu::Iterator::JQTreeView;
2 3 $HTML::Widgets::NavMenu::Iterator::JQTreeView::VERSION = '1.1000';
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use HTML::Widgets::NavMenu::EscapeHtml qw/ escape_html /;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use parent qw(HTML::Widgets::NavMenu::Iterator::NavMenu);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub _init
11 21 ▶{
Subroutine _init: called CC=1 SCAR=0.0
12 21 my $self = shift;
13 21 my $args = shift;
14  
15 21 $self->SUPER::_init($args);
16  
17 # Make a fresh copy just to be on the safe side.
18 21 $self->_ul_classes( [ @{ $args->{'ul_classes'} } ] );
19  
20 21 return 0;
21 }
22  
23  
24 sub _calc_open_li_tag
25 17 ▶{
Subroutine _calc_open_li_tag: called CC=2 SCAR=7.0
26 17 my $self = shift;
27  
28 17 my $id_attr = $self->_calc_li_id_attr();
29  
30 return (
31 17 ▶ $self->_is_expanded_for_treeview()
Branch: 1 branch
BranchTrueFalseTotal
$self->_is_expanded_for_treeview ? : 3 14 17
32 ? (qq{<li class="open"$id_attr>})
33 : ("<li$id_attr>")
34 );
35  
36 0 return;
37 }
38  
39  
40 sub _start_handle_non_role
41 17 ▶{
Subroutine _start_handle_non_role: called CC=3 SCAR=11.0
42 17 my $self = shift;
43 17 my $top_item = $self->top;
44 17 my @tags_to_add = ( $self->_calc_open_li_tag(), $self->get_link_tag() );
45 17 ▶ if ( $top_item->_num_subs_to_go() && $self->_is_expanded() )
Branch: 1 branch
BranchTrueFalseTotal
if ($top_item->_num_subs_to_go and $self->_is_expanded) 4 13 17
Condition66%2/3
$top_item->_num_subs_to_go and $self->_is_expanded
!ll&&!rl&&r
1304
MC/DC50%1/2
$top_item->_num_subs_to_go and $self->_is_expanded
$top_item->_num_subs_to_go $self->_is_expanded
Truth table66%2/3
A and B
A= $top_item->_num_subs_to_goB= $self->_is_expanded
ABresult
0X0
100
111
46 {
47 4 push @tags_to_add, ( $self->get_open_sub_menu_tags() );
48 }
49 17 $self->_add_tags(@tags_to_add);
50  
51 17 return;
52 }
53  
54 sub _start_handle_role
55 0 ▶{
Subroutine _start_handle_role: not called CC=1 SCAR=6.9
56 0 my $self = shift;
57  
58 0 return $self->_start_handle_non_role();
59 }
60  
61 sub _is_expanded
62 49 ▶{
Subroutine _is_expanded: called CC=1 SCAR=0.0
63 49 return 1;
64 }
65  
66 sub _is_expanded_for_treeview
67 17 ▶{
Subroutine _is_expanded_for_treeview: called CC=2 SCAR=7.0
68 17 my $self = shift;
69  
70 17 my $node = $self->top->_node();
71  
72 17 ▶ return ( $node->expanded() || $self->top->_accum_state->{'show_always'} );
Condition66%2/3
$node->expanded || $self->top->_accum_state->{'show_always'}
l!l&&r!l&&!r
3014
MC/DC50%1/2
$node->expanded || $self->top->_accum_state->{'show_always'}
$node->expanded $self->top->_accum_state->{'show_always'}
Truth table66%2/3
A || B
A= $node->expandedB= $self->top->_accum_state->{'show_always'}
ABresult
1X1
011
000
73 }
74  
75  
76 3 1;
77  
78 __END__
« NavMenu/Tree/Iterator/Item.pm ↑ Summary NavMenu/Iterator/NavMenu.pm »