more work on tests
added submission deadline and admin override fields
This commit is contained in:
parent
536c1d03fd
commit
50988eaa64
3 changed files with 42 additions and 12 deletions
|
|
@ -190,12 +190,11 @@ sub definition {
|
||||||
label => $i18n->get("send email label"),
|
label => $i18n->get("send email label"),
|
||||||
hoverHelp => $i18n->get("send email label help")
|
hoverHelp => $i18n->get("send email label help")
|
||||||
},
|
},
|
||||||
commentTab => {
|
adminOverride => {
|
||||||
noFormPost => 1,
|
noFormPost => 1,
|
||||||
tab => "comments",
|
fieldType => "hidden",
|
||||||
fieldType => "hidden",
|
defaultValue => '{}',
|
||||||
customDrawMethod => 'drawComments',
|
},
|
||||||
}
|
|
||||||
);
|
);
|
||||||
push @{$definition}, {
|
push @{$definition}, {
|
||||||
assetName => $i18n->get('assetName'),
|
assetName => $i18n->get('assetName'),
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,13 @@ sub definition {
|
||||||
label => $i18n->get("delete created items label"),
|
label => $i18n->get("delete created items label"),
|
||||||
hoverHelp => $i18n->get("delete created items label help")
|
hoverHelp => $i18n->get("delete created items label help")
|
||||||
},
|
},
|
||||||
|
submissionDeadline => {
|
||||||
|
tab => "properties",
|
||||||
|
fieldType => "Date",
|
||||||
|
defaultValue => undef,
|
||||||
|
label => $i18n->get("submission deadline label"),
|
||||||
|
hoverHelp => $i18n->get("submission deadline label help")
|
||||||
|
},
|
||||||
formDescription => {
|
formDescription => {
|
||||||
tab => "properties",
|
tab => "properties",
|
||||||
fieldType => "text",
|
fieldType => "text",
|
||||||
|
|
|
||||||
|
|
@ -138,15 +138,29 @@ ok( $frmA->validateSubmission({
|
||||||
startDate => '1255150800',
|
startDate => '1255150800',
|
||||||
}), 'a valid submission' );
|
}), 'a valid submission' );
|
||||||
ok( !$frmA->validateSubmission({
|
ok( !$frmA->validateSubmission({
|
||||||
TODO => 1
|
title => 'titlea',
|
||||||
|
description => 'the description',
|
||||||
|
startDate => '1205150800',
|
||||||
}), 'not a valid submission: invalid value' );
|
}), 'not a valid submission: invalid value' );
|
||||||
ok( !$frmA->validateSubmission({
|
ok( !$frmA->validateSubmission({
|
||||||
TODO => 1
|
title => 'titlea',
|
||||||
|
price => 300.0,
|
||||||
|
description => 'the description',
|
||||||
|
startDate => '1255150800',
|
||||||
}), 'not a valid submission: invalid field' );
|
}), 'not a valid submission: invalid field' );
|
||||||
ok( !$frmA->validateSubmission({
|
ok( !$frmA->validateSubmission({
|
||||||
TODO => 1
|
title => 'titlea',
|
||||||
|
duration => 3.0,
|
||||||
|
description => 'the description',
|
||||||
|
startDate => '1255150800',
|
||||||
}), 'not a valid submission: readonly field' );
|
}), 'not a valid submission: readonly field' );
|
||||||
# TODO: test more field validations
|
ok( $frmA->validateSubmission({
|
||||||
|
title => 'titlea',
|
||||||
|
duration => 3.0,
|
||||||
|
description => 'the description',
|
||||||
|
startDate => '1255150800',
|
||||||
|
adminOverride => q{ { 'duration' : 3.0 } },
|
||||||
|
}), 'valid submission: field value override by admin' );
|
||||||
|
|
||||||
|
|
||||||
# TODO use meta field in this form
|
# TODO use meta field in this form
|
||||||
|
|
@ -156,12 +170,22 @@ my $frmB = $ems->addChild({
|
||||||
canSubmitGroup => $submitGroupB->getId,
|
canSubmitGroup => $submitGroupB->getId,
|
||||||
formDescription => q{ {
|
formDescription => q{ {
|
||||||
'title' : { 'type' : 'text' },
|
'title' : { 'type' : 'text' },
|
||||||
'synopsis' : { 'type' : 'textarea' },
|
'description' : { 'type' : 'textarea' },
|
||||||
'duration' : { 'default' : 0.5 },
|
'duration' : { 'default' : 0.5 },
|
||||||
'startDate' : { 'default' : '1255150800' },
|
'startDate' : { 'default' : '1255150800' },
|
||||||
|
'metaField1' : { 'type' : 'Url' },
|
||||||
} },
|
} },
|
||||||
});
|
});
|
||||||
# TODO: test meta field validation
|
ok( $frmA->validateSubmission({
|
||||||
|
title => 'title',
|
||||||
|
description => 'description',
|
||||||
|
metaField1 => 'http://google.com/',
|
||||||
|
}), 'valid submission: test valid metafield value' );
|
||||||
|
ok( !$frmA->validateSubmission({
|
||||||
|
title => 'title',
|
||||||
|
description => 'description',
|
||||||
|
metaField1 => 'joe@sams.org',
|
||||||
|
}), 'invalid submission: test invalid metafield value' );
|
||||||
|
|
||||||
loginUserA;
|
loginUserA;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue