FormHandler/Field/RmElement.pm

filter: Statementstmt 100% 26 / 26 Branchbran n/a Conditioncond 37.5% 3 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 75.0% 33 / 44 CC 4 SCAR 10.4
CC
4
Cov
85%
__ANON__
4.2
build_render_method
1.0
BEGIN
1.0
CRAP 2.8
« FormHandler/Widget/Field/Password.pm ↑ Summary FormHandler/Widget/Field/Textarea.pm »
1 package HTML::FormHandler::Field::RmElement;
2 # ABSTRACT: field to support repeatable javascript remove
3 1 $HTML::FormHandler::Field::RmElement::VERSION = '0.410002';
4 1 ▶use HTML::FormHandler::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 extends 'HTML::FormHandler::Field::Display';
6 1 ▶use HTML::FormHandler::Render::Util ('process_attrs');
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 1 has '+do_wrapper' => ( default => 1 );
10 1 has '+value' => ( default => 'Remove' );
11  
12 2 ▶sub build_render_method {
Subroutine build_render_method: called CC=1 SCAR=0.1
Pod undocumented
13 2 ▶ return sub {
Subroutine __ANON__: called CC=4 SCAR=14.4
14 2 my ( $self, $result ) = @_;
15 2 ▶ $result ||= $self->result;
Condition33%1/3
$result ||= $self->result
l!l&&r!l&&!r
200
MC/DC0%0/2
$result ||= $self->result
$result $self->result
Truth table33%1/3
A ||= B
A= $resultB= $self->result
ABresult
1X1
011
000
16  
17 2 ▶ my $value = $self->html || $self->html_filter($self->_localize($self->value));
Condition33%1/3
$self->html || $self->html_filter($self->_localize($self->value))
l!l&&r!l&&!r
020
MC/DC0%0/2
$self->html || $self->html_filter($self->_localize($self->value))
$self->html $self->html_filter($self->_localize($self->value))
Truth table33%1/3
A || B
A= $self->htmlB= $self->html_filter($self->_localize($self->value))
ABresult
1X1
011
000
18 2 my $attrs = $self->element_attributes($result);
19 2 push @{$attrs->{class}}, ( 'rm_element', 'btn' );
20 2 $attrs->{'data-rep-elem-id'} = $self->parent->id;
21 2 $attrs->{id} = $self->id;
22 2 my $attr_str = process_attrs($attrs);
23 2 ▶ my $wrapper_tag = $self->get_tag('wrapper_tag') || 'div';
Condition50%1/2
$self->get_tag('wrapper_tag') || 'div'
l!l
02
MC/DC0%0/1
$self->get_tag('wrapper_tag') || 'div'
$self->get_tag('wrapper_tag')
Truth table50%1/2
A
A= $self->get_tag('wrapper_tag')
Aresult
11
00
24 2 my $output = qq{<$wrapper_tag$attr_str>$value</$wrapper_tag>};
25 2 $output = $self->wrap_field($self->result, $output);
26 2 return $output;
27 2 };
28 }
29  
30 1 __PACKAGE__->meta->make_immutable;
31 1 1;
32  
33 __END__
« FormHandler/Widget/Field/Password.pm ↑ Summary FormHandler/Widget/Field/Textarea.pm »