don't set tableName on property elements if it is already specified
This commit is contained in:
parent
0e94b4a783
commit
8b975cc810
2 changed files with 11 additions and 4 deletions
|
|
@ -31,7 +31,7 @@ sub import {
|
||||||
if ( my $properties = $definition->{properties} ) {
|
if ( my $properties = $definition->{properties} ) {
|
||||||
my $table = $definition->{tableName};
|
my $table = $definition->{tableName};
|
||||||
for ( my $i = 1; $i < @{ $properties }; $i += 2) {
|
for ( my $i = 1; $i < @{ $properties }; $i += 2) {
|
||||||
$properties->[$i]{tableName} = $table;
|
$properties->[$i]{tableName} ||= $table;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,14 @@ use WebGUI::Test;
|
||||||
package WGT::Class;
|
package WGT::Class;
|
||||||
use WebGUI::Definition::Asset (
|
use WebGUI::Definition::Asset (
|
||||||
attribute1 => 'attribute 1 value',
|
attribute1 => 'attribute 1 value',
|
||||||
|
tableName => 'mytable',
|
||||||
properties => [
|
properties => [
|
||||||
showInForms => {
|
showInForms => {
|
||||||
label => ['show in forms'],
|
label => ['show in forms'],
|
||||||
},
|
},
|
||||||
confirmChange => {
|
confirmChange => {
|
||||||
label => ['confirm change', 'Asset'],
|
label => ['confirm change', 'Asset'],
|
||||||
|
tableName => 'othertable',
|
||||||
},
|
},
|
||||||
noTrans => {
|
noTrans => {
|
||||||
label => 'this label will not be translated',
|
label => 'this label will not be translated',
|
||||||
|
|
@ -42,10 +44,15 @@ use WebGUI::Test;
|
||||||
|
|
||||||
my $object = WGT::Class->instantiate;
|
my $object = WGT::Class->instantiate;
|
||||||
|
|
||||||
is_deeply $object->getProperty('showInForms')->{label}, 'Show In Forms?',
|
is $object->getProperty('showInForms')->{tableName}, 'mytable',
|
||||||
|
'properties copy tableName attribute';
|
||||||
|
is $object->getProperty('confirmChange')->{tableName}, 'othertable',
|
||||||
|
'tableName property element not overwritten if manually specified';
|
||||||
|
|
||||||
|
is $object->getProperty('showInForms')->{label}, 'Show In Forms?',
|
||||||
'getProperty internationalizes label';
|
'getProperty internationalizes label';
|
||||||
is_deeply $object->getProperty('confirmChange')->{label}, 'Are you sure?',
|
is $object->getProperty('confirmChange')->{label}, 'Are you sure?',
|
||||||
'getProperty internationalizes label with namespace';
|
'getProperty internationalizes label with namespace';
|
||||||
is_deeply $object->getProperty('noTrans')->{label}, 'this label will not be translated',
|
is $object->getProperty('noTrans')->{label}, 'this label will not be translated',
|
||||||
q{getProperty doesn't internationalize plain scalars};
|
q{getProperty doesn't internationalize plain scalars};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue