[Jifty-commit] r2524 - in jifty/trunk/t/TestApp: share/web/templates/regions

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Jan 18 00:11:03 EST 2007


Author: nelhage
Date: Thu Jan 18 00:11:03 2007
New Revision: 2524

Added:
   jifty/trunk/t/TestApp/share/web/templates/regions/
   jifty/trunk/t/TestApp/share/web/templates/regions/list
   jifty/trunk/t/TestApp/share/web/templates/regions/long
   jifty/trunk/t/TestApp/share/web/templates/regions/short
   jifty/trunk/t/TestApp/t/13-page-regions.t

Log:
Adding failing tests for the region state variable bug I found during
my Jifty class today.

Added: jifty/trunk/t/TestApp/share/web/templates/regions/list
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp/share/web/templates/regions/list	Thu Jan 18 00:11:03 2007
@@ -0,0 +1,7 @@
+% for my $i (1 .. 5) {
+<% Jifty->web->region(
+        name => 'item-' . $i,
+        path => '/regions/short',
+        defaults => {id => $i})
+   %>
+% }

Added: jifty/trunk/t/TestApp/share/web/templates/regions/long
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp/share/web/templates/regions/long	Thu Jan 18 00:11:03 2007
@@ -0,0 +1,4 @@
+<%args>
+$id
+</%args>
+<% Jifty->web->link(label => "Long $id", onclick => {replace_with => "/regions/short"}) %>

Added: jifty/trunk/t/TestApp/share/web/templates/regions/short
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp/share/web/templates/regions/short	Thu Jan 18 00:11:03 2007
@@ -0,0 +1,4 @@
+<%args>
+$id
+</%args>
+<% Jifty->web->link(label => "Short $id", onclick => {replace_with => "/regions/long"}) %>

Added: jifty/trunk/t/TestApp/t/13-page-regions.t
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp/t/13-page-regions.t	Thu Jan 18 00:11:03 2007
@@ -0,0 +1,40 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+
+use lib 't/lib';
+use Jifty::SubTest;
+
+use Jifty::Test tests => 39;
+use Jifty::Test::WWW::Mechanize;
+
+my $server  = Jifty::Test->make_server;
+
+isa_ok($server, 'Jifty::Server');
+
+my $URL = $server->started_ok;
+
+my $mech = Jifty::Test::WWW::Mechanize->new;
+
+$mech->get_ok("$URL/regions/list");
+
+$mech->content_contains("Short $_")
+  for (1 .. 5);
+
+for my $i (1 .. 5) {
+    ok($mech->find_link(text => "Short $i"), "Found link: Short $i");
+    $mech->follow_link_ok(text => "Short $i");
+    $mech->content_contains(text => "Long $i");
+}
+
+$mech->content_contains("Long $_")
+  for (1 .. 5);
+
+ok($mech->find_link(text => "Long 1"), "Found link Long 1");
+$mech->follow_link_ok(text => "Long 1");
+
+$mech->content_contains(text => "Short 1");
+for my $i (2 .. 5) {
+    $mech->content_contains("Long $i");
+    $mech->content_lacks("Short $i");
+}


More information about the Jifty-commit mailing list