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

svn at limb-project.com svn at limb-project.com
Mon Sep 10 12:31:55 MSD 2007


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

Modified:
   3.x/trunk/limb/macro/src/lmbMacroTreeBuilder.class.php
   3.x/trunk/limb/macro/tests/cases/tags/lmbMacroWrapTagTest.class.php
Log:
-- nested <%wrap%> tag tests pass

Modified: 3.x/trunk/limb/macro/src/lmbMacroTreeBuilder.class.php
===================================================================
--- 3.x/trunk/limb/macro/src/lmbMacroTreeBuilder.class.php	2007-09-10 08:13:14 UTC (rev 6282)
+++ 3.x/trunk/limb/macro/src/lmbMacroTreeBuilder.class.php	2007-09-10 08:31:55 UTC (rev 6283)
@@ -171,7 +171,7 @@
   function getExpectedTagLocation()
   {
     $item = end($this->expected_tags);
-    return $item[2];
+    return $item[1];
   }
 }
 

Modified: 3.x/trunk/limb/macro/tests/cases/tags/lmbMacroWrapTagTest.class.php
===================================================================
--- 3.x/trunk/limb/macro/tests/cases/tags/lmbMacroWrapTagTest.class.php	2007-09-10 08:13:14 UTC (rev 6282)
+++ 3.x/trunk/limb/macro/tests/cases/tags/lmbMacroWrapTagTest.class.php	2007-09-10 08:31:55 UTC (rev 6283)
@@ -34,6 +34,38 @@
     $this->assertEqual($out, '<p>Hello, Bob</p>');
   }
 
+  function testWrapWithVariables()
+  {
+    $bar = '<%wrap with="foo.html" into="slot1"%><?php echo $this->bob?><%/wrap%>';
+    $foo = '<p>Hello, <%slot id="slot1"/%></p>';
+
+    $bar_tpl = $this->_createTemplate($bar, 'bar.html');
+    $foo_tpl = $this->_createTemplate($foo, 'foo.html');
+
+    $macro = $this->_createMacro($bar_tpl);
+    $macro->set('bob', 'Bob');
+
+    $out = $macro->render();
+    $this->assertEqual($out, '<p>Hello, Bob</p>');
+  }
+
+  function testNestedWrap()
+  {
+    $bar = '<%wrap with="foo.html" into="slot1"%><?php echo $this->bob?><%/wrap%>';
+    $foo = '<%wrap with="zoo.html" into="slot2"%><p>Hello, <%slot id="slot1"/%></p><%/wrap%>';
+    $zoo = '<body><%slot id="slot2"/%></body>';
+
+    $bar_tpl = $this->_createTemplate($bar, 'bar.html');
+    $foo_tpl = $this->_createTemplate($foo, 'foo.html');
+    $zoo_tpl = $this->_createTemplate($zoo, 'zoo.html');
+
+    $macro = $this->_createMacro($bar_tpl);
+    $macro->set('bob', 'Bob');
+
+    $out = $macro->render();
+    $this->assertEqual($out, '<body><p>Hello, Bob</p></body>');
+  }
+
   protected function _createMacro($file)
   {
     $base_dir = LIMB_VAR_DIR . '/tpl';



More information about the limb-svn mailing list