Finish Copy (self) Helper.

This commit is contained in:
Colin Kuskie 2009-11-25 16:45:09 -08:00
parent 7298af49ea
commit 0b124f269c
2 changed files with 26 additions and 25 deletions

View file

@ -72,7 +72,6 @@ sub process {
allowComments => 1,
returnUrl => $asset->getUrl,
}) eq 'redirect') {
return undef;
$payload->{open_tab} = $session->http->getRedirectLocation;
};

View file

@ -39,35 +39,37 @@ plan tests => 3; # Increment this number for each test you create
my $output;
my $home = WebGUI::Asset->getDefault($session);
$output = WebGUI::AssetHelper::Copy->process($home);
cmp_deeply(
$output,
{
message => re('was copied to the clipboard'),
},
'AssetHelper/Copy redirects the back to the copied asset'
);
{
my $clippies = $home->getAssetsInClipboard();
is @{ $clippies }, 1, '... only copied 1 asset to the clipboard, no children';
$output = WebGUI::AssetHelper::Copy->process($home);
cmp_deeply(
$output,
{
message => re('was copied to the clipboard'),
},
'AssetHelper/Copy redirects the back to the copied asset'
);
foreach my $asset (@{ $clippies }) {
$asset->purge;
my $clippies = $home->getAssetsInClipboard();
is @{ $clippies }, 1, '... only copied 1 asset to the clipboard, no children';
addToCleanup(@{ $clippies });
}
$session->setting->set('skipCommitComments', 0);
{
$session->setting->set('skipCommitComments', 0);
$output = WebGUI::AssetHelper::Copy->process($home);
cmp_deeply(
$output,
{
message => re('was copied to the clipboard'),
open_tab => $home->getUrl,
},
'AssetHelper/Copy opens a tab for commit comments'
);
$output = WebGUI::AssetHelper::Copy->process($home);
cmp_deeply(
$output,
{
message => re('was copied to the clipboard'),
open_tab => re('^'.$home->getUrl),
},
'AssetHelper/Copy opens a tab for commit comments'
);
foreach my $asset (@{ $clippies }) {
$asset->purge;
my $clippies = $home->getAssetsInClipboard();
addToCleanup(@{ $clippies });
}
#vim:ft=perl