diff _test/Test/DOM/Node.pm @ 124:e30bdd040fe3

IMPL::Web::TT::Form concept
author wizard
date Thu, 10 Jun 2010 02:45:59 +0400
parents 1d7e370a91fa
children e6447ad85cb4
line wrap: on
line diff
--- a/_test/Test/DOM/Node.pm	Wed Jun 09 17:53:12 2010 +0400
+++ b/_test/Test/DOM/Node.pm	Thu Jun 10 02:45:59 2010 +0400
@@ -153,6 +153,46 @@
 	} and failed "Setting a private property successfull";
 };
 
+test createNodeWithProps => sub {
+	my $uuid = 'entity_76fd98b9e7a';
+	my $name = 'Vergon 6';
+	my $systemName = 'entity_vergon_6';
+	
+	my $node = Test::DOM::TypedNode->new(
+		nodeName => 'TestNode',
+		uuid => $uuid,
+		name => $name,
+		systemName => $systemName 
+	);
+	
+	failed "Failed to get dynamic property 'uuid'" unless $node->nodeProperty('uuid') eq $uuid;
+	failed "Failed to get property 'name' through nodeProperty method" unless $node->nodeProperty('name') eq $name;
+	failed "Failed to get property name directly" unless $node->name eq $name;
+};
+
+test listNodePredefinedProps => sub {
+	my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
+	
+	my @props = $node->listProperties;
+	my @expected = qw(name _private);
+	
+	failed "Got wrong list of props", @props unless cmparray(\@props,\@expected);
+};
+
+test listNodeAllProps => sub {
+	my $node = Test::DOM::TypedNode->new(
+		nodeName => 'TestNode',
+		uuid => 'ade58f98b', # dynamic
+		name => 'noname', # predefined
+		systemName => 'no sys' # not visible to DOM
+	);
+	
+	my @props = $node->listProperties;
+	my @expected = qw(name _private uuid); # systemName is not a DOM prop
+	
+	failed "Got wrong list of props", @props unless cmparray(\@props,\@expected);
+};
+
 package Test::DOM::TypedNode;
 use base qw(IMPL::DOM::Node);
 use IMPL::Class::Property;