More exceptions for the Test::Class tests as to which labels should and don't need to appear in forms.
This commit is contained in:
parent
f2d411cf1f
commit
acd71a7f7e
7 changed files with 23 additions and 8 deletions
|
|
@ -479,7 +479,7 @@ sub t_11_getEditForm : Tests {
|
|||
my $session = $test->session;
|
||||
my ( $tag, $asset, @parents ) = $test->getAnchoredAsset();
|
||||
|
||||
local $SIG{__DIE__} = sub { use Carp; Carp::confess "@_"; };
|
||||
# local $SIG{__DIE__} = sub { use Carp; Carp::confess "@_"; };
|
||||
|
||||
my $f = $asset->getEditForm;
|
||||
|
||||
|
|
@ -504,13 +504,12 @@ local $SIG{__DIE__} = sub { use Carp; Carp::confess "@_"; };
|
|||
# Properties
|
||||
use Data::Dumper;
|
||||
|
||||
# note( "f: " . Dumper $f->getFieldsRecursive );
|
||||
|
||||
# $asset->getProperties vs $asset->getEditForm->getFieldsRecursive
|
||||
# compare $asset->getProperties to $asset->getEditForm->getFieldsRecursive
|
||||
|
||||
my @properties = (
|
||||
List::MoreUtils::uniq # no dups, please
|
||||
$test->dynamic_form_labels, # per-test hard-coded labels known to be added at runtime vs with property blocks
|
||||
grep { ($_ ne 'Mobile Template') xor $session->setting->get('useMobileStyle') }
|
||||
grep $_, # a rare few property blocks have niether noFormPost nor label? XXX TODO tests/fix
|
||||
map { $asset->getFormProperties($_)->{label} } # getFormProperties returns a plain hash
|
||||
grep { ! $asset->meta->find_attribute_by_name( $_ )->noFormPost }
|
||||
|
|
@ -519,13 +518,13 @@ local $SIG{__DIE__} = sub { use Carp; Carp::confess "@_"; };
|
|||
|
||||
my @form = (
|
||||
List::MoreUtils::uniq
|
||||
grep { $_ and $_ ne 'Keywords' and $_ ne 'Class Name' and $_ ne 'Asset ID' }
|
||||
grep { $_ and $_ ne 'Keywords' and $_ ne 'Class Name' and $_ ne 'Asset ID' and $_ ne 'Approved' }
|
||||
map $_->get('label'),
|
||||
flattenFormObjects($f->getFieldsRecursive) # mixture of arrays of Form objects and arrays-of-arrays of them; flatten it out
|
||||
);
|
||||
|
||||
my %superlist = map { ( $_ => 1 ) } @form, @properties;
|
||||
note "all labels: " . join ', ', keys %superlist;
|
||||
# note "all labels: " . join ', ', keys %superlist;
|
||||
|
||||
for my $label (keys %superlist) {
|
||||
no warnings 'uninitialized';
|
||||
|
|
|
|||
|
|
@ -25,4 +25,6 @@ sub parent_list {
|
|||
return [qw/WebGUI::Asset::Wobject::Gallery WebGUI::Asset::Wobject::GalleryAlbum /];
|
||||
}
|
||||
|
||||
sub dynamic_form_labels { return 'New file to upload' };
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ sub list_of_tables {
|
|||
return [qw/assetData FileAsset ImageAsset/];
|
||||
}
|
||||
|
||||
sub dynamic_form_labels { return 'New file to upload', 'Approved'; }
|
||||
sub dynamic_form_labels { return 'New file to upload'; }
|
||||
|
||||
sub t_11_getEditForm : Tests( 2 ) {
|
||||
my $test = shift;
|
||||
|
|
|
|||
|
|
@ -25,4 +25,6 @@ sub list_of_tables {
|
|||
return [qw/assetData RichEdit/];
|
||||
}
|
||||
|
||||
sub dynamic_form_labels { return 'Toolbar Buttons' }
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -24,4 +24,6 @@ sub list_of_tables {
|
|||
return [qw/assetData Shortcut/];
|
||||
}
|
||||
|
||||
sub dynamic_form_labels { return 'Asset to Mirror' }
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -21,4 +21,14 @@ sub list_of_tables {
|
|||
return [qw/assetData template/];
|
||||
}
|
||||
|
||||
sub postProcessMergedProperties {
|
||||
my $test = shift;
|
||||
my $properties = shift;
|
||||
if( exists $properties->{attachmentsJson} and ! defined $properties->{attachmentsJson} ) {
|
||||
$properties->{attachmentsJson} = '[{"url":"/webgui.css","type":"stylesheet"}]';
|
||||
}
|
||||
}
|
||||
|
||||
sub dynamic_form_labels { return 'Template Type' };
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ sub list_of_tables {
|
|||
}
|
||||
|
||||
sub dynamic_form_labels {
|
||||
return 'Reset votes?', 'Answers', 'Generate image graph', 'Approved';
|
||||
return 'Reset votes?', 'Answers', 'Generate image graph';
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue