[limb-svn] r6282 - in 3.x/trunk/limb/macro: src src/tags tests/cases

svn at limb-project.com svn at limb-project.com
Mon Sep 10 12:13:14 MSD 2007


Author: pachanga
Date: 2007-09-10 12:13:14 +0400 (Mon, 10 Sep 2007)
New Revision: 6282
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6282

Modified:
   3.x/trunk/limb/macro/src/lmbMacroNode.class.php
   3.x/trunk/limb/macro/src/lmbMacroTagParsingState.class.php
   3.x/trunk/limb/macro/src/tags/wrap.tag.php
   3.x/trunk/limb/macro/tests/cases/lmbMacroTagTest.class.php
Log:
-- initial <%wrap%> tag implementation

Modified: 3.x/trunk/limb/macro/src/lmbMacroNode.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/lmbMacroNode.class.php	2007-09-10 05:57:50 UTC (rev 6281)
+++ 3.x/trunk/limb/macro/src/lmbMacroNode.class.php	2007-09-10 08:13:14 UTC (rev 6282)
@@ -132,7 +132,10 @@
       if($child->getId() == $id)
         return $child;
       else
-        return $child->findChild($id);          
+      {
+        if($result = $child->findChild($id))
+          return $result;
+      }
     }
   }
 

Modified: 3.x/trunk/limb/macro/src/lmbMacroTagParsingState.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/lmbMacroTagParsingState.class.php	2007-09-10 05:57:50 UTC (rev 6281)
+++ 3.x/trunk/limb/macro/src/lmbMacroTagParsingState.class.php	2007-09-10 08:13:14 UTC (rev 6282)
@@ -51,7 +51,7 @@
 
   function endElement($tag)
   {
-    $tag_info = $this->tag_dictionary->getTagInfo($tag);
+    $tag_info = $this->tag_dictionary->findTagInfo($tag);
     $location = $this->parser->getCurrentLocation();
 
     if($tag_info->isEndTagForbidden())

Modified: 3.x/trunk/limb/macro/src/tags/wrap.tag.php
===================================================================
--- 3.x/trunk/limb/macro/src/tags/wrap.tag.php	2007-09-10 05:57:50 UTC (rev 6281)
+++ 3.x/trunk/limb/macro/src/tags/wrap.tag.php	2007-09-10 08:13:14 UTC (rev 6282)
@@ -72,7 +72,7 @@
     if($replace)
       $insertionPoint->removeChildren();
 
-    $tree_builder->pushCursor($insertionPoint, $this->location_in_template);
+    $tree_builder->pushCursor($insertionPoint, $this->location);
   }
 }
 

Modified: 3.x/trunk/limb/macro/tests/cases/lmbMacroTagTest.class.php
===================================================================
--- 3.x/trunk/limb/macro/tests/cases/lmbMacroTagTest.class.php	2007-09-10 05:57:50 UTC (rev 6281)
+++ 3.x/trunk/limb/macro/tests/cases/lmbMacroTagTest.class.php	2007-09-10 08:13:14 UTC (rev 6282)
@@ -56,9 +56,20 @@
     $mock = new MockMacroNode();
     $mock->setReturnValue('getId', 'Test');
     $this->node->addChild($mock);
-    $this->assertIsA($this->node->findChild('Test'), 'MockMacroNode');
+    $this->assertEqual($this->node->findChild('Test')->getId(), 'Test');
   }
 
+  function testFindChildInMany()
+  {
+    $node1 = new MockMacroNode();
+    $node1->setReturnValue('getId', 'foo');
+    $node2 = new MockMacroNode();
+    $node2->setReturnValue('getId', 'bar');
+    $this->node->addChild($node1);
+    $this->node->addChild($node2);
+    $this->assertEqual($this->node->findChild('bar')->getId(), 'bar');
+  }
+
   function testFindChildNotFound()
   {
     $this->assertFalse($this->node->findChild('Test'));
@@ -76,7 +87,7 @@
     $this->assertFalse($this->node->findChildByClass('Booo'));
   }
 
-  function testFindParentByChilld()
+  function testFindParentByChild()
   {
     $parent = new lmbMacroNode;
     $parent->addChild($this->node);



More information about the limb-svn mailing list