[Jifty-commit] r3264 - in Template-Declare: t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sun May 20 03:56:07 EDT 2007


Author: jesse
Date: Sun May 20 03:56:06 2007
New Revision: 3264

Modified:
   Template-Declare/   (props changed)
   Template-Declare/t/subtemplates.t

Log:
 r56981 at pinglin:  jesse | 2007-05-20 03:54:21 -0400
 * Tests for new relative template calling syntax
 


Modified: Template-Declare/t/subtemplates.t
==============================================================================
--- Template-Declare/t/subtemplates.t	(original)
+++ Template-Declare/t/subtemplates.t	Sun May 20 03:56:06 2007
@@ -12,36 +12,70 @@
 
 html { 
     head { };
-        body {
-            show 'my/content'
-        }
+        body { show 'my/content' }
 }
 
 };
 
+template toplevel => sub {
+    html { head {};
+        body  { show 'content' }
+        };
+};
+
+
 template 'my/content' => sub {
-        div { attr { id => 'body' }
-            outs('This is my content')
+        div { attr { id => 'body' };
+            p {'This is my content'}
         }
+};
+
+
+template 'my/wrapper' => sub {
+    show 'content';
 
 };
 
+template  'content' => sub { 
+    p { 'TOPLEVEL CONTENT'};
+};
+
 
 Template::Declare->init(roots => ['Wifty::UI']);
 
 
 {
+Template::Declare->buffer->clear;
 my $simple =(show('my/content'));
 ok($simple =~ 'This is my content');
 #diag ($simple);
 ok_lint($simple);
 }
 {
+Template::Declare->buffer->clear;
 my $simple =(show('simple'));
 ok($simple =~ 'This is my content');
 #diag ($simple);
 ok_lint($simple);
 }
+{
+Template::Declare->buffer->clear;
+my $simple = (show('toplevel'));
+#diag $simple;
+ok ($simple =~ /TOPLEVEL/, "CAlling /toplevel does call /content");
+ok_lint($simple);
+}
+
+{
+Template::Declare->buffer->clear;
+my $simple = (show('my/wrapper'));
+ok ($simple !~ /TOPLEVEL/, " Calling my/wrapper doesn't call /content" );
+ok ($simple =~/my content/, "calling my/wrapper does call my/content");
+ok_lint($simple);
+}
+
+
+
 
 
 1;


More information about the Jifty-commit mailing list