migrate Product www_editSpecification to FormBuilder
This commit is contained in:
parent
f157ddfe58
commit
ed70aa8929
2 changed files with 91 additions and 29 deletions
|
|
@ -36,7 +36,7 @@ my $session = WebGUI::Test->session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 49; # Increment this number for each test you create
|
||||
plan tests => 58; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
|
|
@ -349,3 +349,65 @@ cmp_deeply(
|
|||
],
|
||||
);
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# editSpecification
|
||||
my $mech = WebGUI::Test::Mechanize->new( config => WebGUI::Test->file );
|
||||
$mech->get_ok( '/' );
|
||||
$mech->session->user({ userId => 3 });
|
||||
$mech->get_ok( $product->getUrl( 'func=editSpecification' ) );
|
||||
|
||||
$mech->submit_form_ok({
|
||||
fields => {
|
||||
name => "One",
|
||||
value => "1",
|
||||
units => "Oneitude",
|
||||
proceed => 1,
|
||||
},
|
||||
}, 'add one new specification');
|
||||
|
||||
$product = $product->cloneFromDb;
|
||||
cmp_deeply(
|
||||
$product->getAllCollateral( 'specificationJSON' ),
|
||||
[
|
||||
{ name => "One", value => "1", units => "Oneitude", specificationId => ignore(), },
|
||||
],
|
||||
);
|
||||
|
||||
$mech->submit_form_ok({
|
||||
fields => {
|
||||
name => "Cold",
|
||||
value => "2",
|
||||
units => "Colditude",
|
||||
proceed => 0,
|
||||
},
|
||||
}, 'add one more new feature' );
|
||||
|
||||
$product = $product->cloneFromDb;
|
||||
cmp_deeply(
|
||||
$product->getAllCollateral( 'specificationJSON' ),
|
||||
[
|
||||
{ name => "One", value => "1", units => "Oneitude", specificationId => ignore(), },
|
||||
{ name => "Cold", value => "2", units => "Colditude", specificationId => ignore(), },
|
||||
],
|
||||
);
|
||||
|
||||
my $spec = $product->getAllCollateral( 'specificationJSON' )->[0];
|
||||
$mech->get_ok( $product->getUrl( 'func=editSpecification;sid=' . $spec->{specificationId} ) );
|
||||
|
||||
$mech->submit_form_ok( {
|
||||
fields => {
|
||||
name => "Oneitude",
|
||||
value => "3",
|
||||
units => "Ones",
|
||||
},
|
||||
}, 'edit an existing specification' );
|
||||
$product = $product->cloneFromDb;
|
||||
cmp_deeply(
|
||||
$product->getAllCollateral( 'specificationJSON' ),
|
||||
[
|
||||
{ name => "Oneitude", value => "3", units => "Ones", specificationId => $spec->{specificationId}, },
|
||||
{ name => "Cold", value => "2", units => "Colditude", specificationId => ignore(), },
|
||||
],
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue