more test work

This commit is contained in:
Doug Bell 2010-05-24 11:34:45 -05:00
parent e891410075
commit eec0780893
7 changed files with 31 additions and 5 deletions

View file

@ -22,6 +22,7 @@ use HTML::Packer;
use Moose; use Moose;
use WebGUI::Types; use WebGUI::Types;
use Data::Dumper; use Data::Dumper;
use WebGUI::FormBuilder;
use WebGUI::Definition::Asset; use WebGUI::Definition::Asset;
define assetName => ['asset', 'Asset']; define assetName => ['asset', 'Asset'];

View file

@ -9,7 +9,7 @@ requires 'session', 'pack', 'unpack';
has 'fields' => ( has 'fields' => (
is => 'rw', is => 'rw',
isa => 'ArrayRef[WebGUI::Form::Control]', isa => 'ArrayRef',
default => sub { [] }, default => sub { [] },
); );

View file

@ -5,7 +5,7 @@ use Moose::Role;
has 'fieldsets' => ( has 'fieldsets' => (
is => 'rw', is => 'rw',
isa => 'ArrayRef[WebGUI::FormBuilder::Fieldset]', isa => 'ArrayRef',
default => sub { [] }, default => sub { [] },
); );

View file

@ -4,7 +4,7 @@ use Moose::Role;
has 'objects' => ( has 'objects' => (
is => 'rw', is => 'rw',
isa => 'ArrayRef[Object]', isa => 'ArrayRef',
default => sub { [] }, default => sub { [] },
); );

View file

@ -9,7 +9,7 @@ requires 'session', 'pack', 'unpack';
has 'tabsets' => ( has 'tabsets' => (
is => 'rw', is => 'rw',
isa => 'ArrayRef[WebGUI::FormBuilder::Tabset]', isa => 'ArrayRef',
default => sub { [] }, default => sub { [] },
); );
@ -137,6 +137,7 @@ Get a tabset object by name
sub getTabset { sub getTabset {
my ( $self, $name ) = @_; my ( $self, $name ) = @_;
$name ||= "default";
return $self->{_tabsetsByName}{$name}; return $self->{_tabsetsByName}{$name};
} }

View file

@ -12,7 +12,7 @@ has 'name' => (
has 'tabs' => ( has 'tabs' => (
is => 'rw', is => 'rw',
isa => 'ArrayRef[WebGUI::FormBuilder::Tab]', isa => 'ArrayRef',
default => sub { [] }, default => sub { [] },
); );

View file

@ -346,6 +346,23 @@ sub getEditForm : Tests {
my $session = $test->session; my $session = $test->session;
my ( $tag, $asset, @parents ) = $test->getAnchoredAsset(); my ( $tag, $asset, @parents ) = $test->getAnchoredAsset();
my $f = $asset->getEditForm;
isa_ok( $f, 'WebGUI::FormBuilder' );
# assetId, className, keywords
isa_ok( $f->getField('assetId'), 'WebGUI::Form::Guid' );
isa_ok( $f->getField('className'), 'WebGUI::Form::ClassName' );
isa_ok( $f->getField('keywords'), 'WebGUI::Form::Keywords' );
# Properties
# Metadata
# Property overrides
not_ok( $f->getField('func'), 'form must not contain "func"' );
} }
sub www_editSave : Tests { sub www_editSave : Tests {
@ -353,6 +370,8 @@ sub www_editSave : Tests {
my ( $test ) = @_; my ( $test ) = @_;
my $session = $test->session; my $session = $test->session;
my ( $tag, $asset, @parents ) = $test->getAnchoredAsset(); my ( $tag, $asset, @parents ) = $test->getAnchoredAsset();
# Alter permissions so www_editSave works
my $oldGroupId = $asset->groupIdEdit; my $oldGroupId = $asset->groupIdEdit;
$asset->groupIdEdit( 7 ); # Everybody! Everybody! $asset->groupIdEdit( 7 ); # Everybody! Everybody!
@ -367,6 +386,11 @@ sub www_editSave : Tests {
ok( $newRevision->tagId, 'new revision has a tag' ); ok( $newRevision->tagId, 'new revision has a tag' );
is( $newRevision->tagId, $tag->getId, 'new revision tagId is current working tag' ); is( $newRevision->tagId, $tag->getId, 'new revision tagId is current working tag' );
# Alter permissions so it does not work
# Set locked so it does not work
$asset->groupIdEdit( $oldGroupId ); $asset->groupIdEdit( $oldGroupId );
} }