Justin Hileman преди 9 години
родител
ревизия
131cad6024
променени са 1 файла, в които са добавени 37 реда и са изтрити 0 реда
  1. 37 0
      test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php

+ 37 - 0
test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php

@@ -33,6 +33,36 @@ EOS;
   <input placeholder="ENTER YOUR NAME">
 </fieldset>
 
+EOS;
+
+        $m = new Mustache_Engine(array(
+            'partials' => array('input' => $partial),
+        ));
+
+        $tpl = $m->loadTemplate($src);
+
+        $data = new Mustache_Test_FiveThree_Functional_ClassWithLambda();
+        $this->assertEquals($expected, $tpl->render($data));
+    }
+
+    public function testLambdaInterpolationsInsidePartialsAreIndentedProperly()
+    {
+        $src = <<<EOS
+<fieldset>
+  {{> input }}
+</fieldset>
+
+EOS;
+        $partial = <<<EOS
+<input placeholder="{{ placeholder }}">
+
+EOS;
+
+        $expected = <<<EOS
+<fieldset>
+  <input placeholder="Enter your name">
+</fieldset>
+
 EOS;
 
         $m = new Mustache_Engine(array(
@@ -54,4 +84,11 @@ class Mustache_Test_FiveThree_Functional_ClassWithLambda
             return strtoupper($val);
         };
     }
+
+    public function placeholder()
+    {
+        return function() {
+            return 'Enter your name';
+        };
+    }
 }