Merge branch 'static_definition' of github.com:plainblack/webgui into static_definition

This commit is contained in:
JT Smith 2009-10-22 10:11:27 -05:00
commit fca4cfbbaf
2 changed files with 11 additions and 4 deletions

View file

@ -31,7 +31,7 @@ sub import {
if ( my $properties = $definition->{properties} ) {
my $table = $definition->{tableName};
for ( my $i = 1; $i < @{ $properties }; $i += 2) {
$properties->[$i]{tableName} = $table;
$properties->[$i]{tableName} ||= $table;
}
}

View file

@ -22,12 +22,14 @@ use WebGUI::Test;
package WGT::Class;
use WebGUI::Definition::Asset (
attribute1 => 'attribute 1 value',
tableName => 'mytable',
properties => [
showInForms => {
label => ['show in forms'],
},
confirmChange => {
label => ['confirm change', 'Asset'],
tableName => 'othertable',
},
noTrans => {
label => 'this label will not be translated',
@ -42,10 +44,15 @@ use WebGUI::Test;
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';
is_deeply $object->getProperty('confirmChange')->{label}, 'Are you sure?',
is $object->getProperty('confirmChange')->{label}, 'Are you sure?',
'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};