Mercurial > pub > Impl
diff _test/Test/DOM/Node.pm @ 148:e6447ad85cb4
DOM objects now have a schema and schemaSource properties
RegExp now can launder data
Improved post to DOM transformation (multiple values a now supported)
Added new axes to navigation queries: ancestor and descendant
minor changes and bug fixes
author | wizard |
---|---|
date | Mon, 16 Aug 2010 08:26:44 +0400 |
parents | e30bdd040fe3 |
children | 4267a2ac3d46 |
line wrap: on
line diff
--- a/_test/Test/DOM/Node.pm Mon Aug 09 08:45:36 2010 +0400 +++ b/_test/Test/DOM/Node.pm Mon Aug 16 08:26:44 2010 +0400 @@ -45,6 +45,15 @@ failed "document property returned incorrect value" unless $child->document == $this->Root; }; +test DocumentCreateNode => sub { + my ($this) = @_; + + my $child = $this->Root->firstChild->appendNode($this->Root->Create(Info => { uuid => '77f9-9a-6d58' } )) or failed "Failed to append a child node"; + + failed "document property is undef" unless $child->document; + failed "document property returned incorrect value" unless $child->document == $this->Root; +}; + test MoveNode => sub { my ($this) = @_; @@ -94,6 +103,30 @@ unless @result == 2; }; +test SelectNodesPath => sub { + my ($this) = @_; + + my @result = $this->Root->selectNodes('Child','Info'); + + failed "Failed to select a node by path 'Child/Info'" unless @result; +}; + +test SelectByAxisDescendant => sub { + my ($this) = @_; + + my @result = $this->Root->selectNodes( { descendant => ['GrandChild','Info']} ); + + failed "Failed to select a node by path '//(GrandChild|Info)/'" unless @result == 2; +}; + +test SelectByAxisAncestor => sub { + my ($this) = @_; + + my @result = $this->Root->selectSingleNode( { descendant => 'Info'} )->selectNodes( { ancestor => undef } ) ; + + failed "Failed to select a node by path '//Info/ancestor:*'" unless @result == 2; +}; + test CheckNodesValues => sub { my ($this) = @_; @@ -118,7 +151,7 @@ my ($this) = @_; failed "property isComplex returned false for the root node" unless $this->Root->isComplex; - failed "property isComplex returned true for a simple node", $this->Root->firstChild->nodeName if $this->Root->firstChild->isComplex; + failed "property isComplex returned true for a simple node", $this->Root->selectSingleNode('Item')->childNodes->Count if $this->Root->selectSingleNode('Item')->isComplex; }; test setObjectProperty => sub {