comparison _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
comparison
equal deleted inserted replaced
123:1d7e370a91fa 124:e30bdd040fe3
149 149
150 eval { 150 eval {
151 $node->nodeProperty(_private => 'failed'); 151 $node->nodeProperty(_private => 'failed');
152 1; 152 1;
153 } and failed "Setting a private property successfull"; 153 } and failed "Setting a private property successfull";
154 };
155
156 test createNodeWithProps => sub {
157 my $uuid = 'entity_76fd98b9e7a';
158 my $name = 'Vergon 6';
159 my $systemName = 'entity_vergon_6';
160
161 my $node = Test::DOM::TypedNode->new(
162 nodeName => 'TestNode',
163 uuid => $uuid,
164 name => $name,
165 systemName => $systemName
166 );
167
168 failed "Failed to get dynamic property 'uuid'" unless $node->nodeProperty('uuid') eq $uuid;
169 failed "Failed to get property 'name' through nodeProperty method" unless $node->nodeProperty('name') eq $name;
170 failed "Failed to get property name directly" unless $node->name eq $name;
171 };
172
173 test listNodePredefinedProps => sub {
174 my $node = Test::DOM::TypedNode->new(nodeName => 'TestNode');
175
176 my @props = $node->listProperties;
177 my @expected = qw(name _private);
178
179 failed "Got wrong list of props", @props unless cmparray(\@props,\@expected);
180 };
181
182 test listNodeAllProps => sub {
183 my $node = Test::DOM::TypedNode->new(
184 nodeName => 'TestNode',
185 uuid => 'ade58f98b', # dynamic
186 name => 'noname', # predefined
187 systemName => 'no sys' # not visible to DOM
188 );
189
190 my @props = $node->listProperties;
191 my @expected = qw(name _private uuid); # systemName is not a DOM prop
192
193 failed "Got wrong list of props", @props unless cmparray(\@props,\@expected);
154 }; 194 };
155 195
156 package Test::DOM::TypedNode; 196 package Test::DOM::TypedNode;
157 use base qw(IMPL::DOM::Node); 197 use base qw(IMPL::DOM::Node);
158 use IMPL::Class::Property; 198 use IMPL::Class::Property;