[Jifty-commit] r4689 - in jifty/trunk/t/TestApp-JiftyJS: t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Dec 14 04:49:15 EST 2007


Author: gugod
Date: Fri Dec 14 04:49:15 2007
New Revision: 4689

Added:
   jifty/trunk/t/TestApp-JiftyJS/t/4-tangent.t
Modified:
   jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm
   jifty/trunk/t/TestApp-JiftyJS/t/3-continuation.t

Log:
Add a simple tangent/return test file, this is to protect the
behaviour that, clicking on a "return" link should return to previous
tangent point, or default location if none.


Modified: jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm
==============================================================================
--- jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm	(original)
+++ jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm	Fri Dec 14 04:49:15 2007
@@ -96,5 +96,22 @@
     }
 };
 
-##
+### tangent/reutrn test temapltes
+
+template '/tangent/returner' => page {
+    Jifty->web->return( label => "Go Back", to => "/", id => 'returner' )->render;
+};
+
+template '/tangent/page1' => page {
+    tangent( label => "Go to Returner", url => "/tangent/returner", id => 'to-returner' );
+};
+
+template '/tangent/page2' => page {
+    tangent( label => "Go to Returner", url => "/tangent/returner", id => 'to-returner' );
+};
+
+template '/tangent/page3' => page {
+    hyperlink( label => "Go to Returner", url => "/tangent/returner", id => 'to-returner' );
+};
+
 1;

Modified: jifty/trunk/t/TestApp-JiftyJS/t/3-continuation.t
==============================================================================
--- jifty/trunk/t/TestApp-JiftyJS/t/3-continuation.t	(original)
+++ jifty/trunk/t/TestApp-JiftyJS/t/3-continuation.t	Fri Dec 14 04:49:15 2007
@@ -1,4 +1,4 @@
-# This test is for testing Jifty.update() javascript function.
+# Test simple continuation using the example in Jifty::Manual::Continuation
 
 use strict;
 use warnings;

Added: jifty/trunk/t/TestApp-JiftyJS/t/4-tangent.t
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp-JiftyJS/t/4-tangent.t	Fri Dec 14 04:49:15 2007
@@ -0,0 +1,45 @@
+# Test tangent / return
+
+use strict;
+use warnings;
+use lib 't/lib';
+use Jifty::SubTest;
+use Jifty::Test tests => 17;
+use Jifty::Test::WWW::Selenium;
+use utf8;
+
+my $server = Jifty::Test->make_server;
+my $sel    = Jifty::Test::WWW::Selenium->rc_ok($server);
+my $URL    = $server->started_ok;
+
+{
+    # /tangent/page1 -- tangent --> /tangent/returner -- return --> /tangent/page1
+
+    $sel->open_ok("/tangent/page1");
+    $sel->do_command_ok("clickAndWait", "to-returner");
+    like $sel->get_location, qr{/tangent/returner}, "URL looks like /tangent/returner";
+    $sel->do_command_ok("clickAndWait", "returner");
+    like $sel->get_location, qr{/tangent/page1}, "URL looks like /tangent/page1";
+}
+
+{
+    # /tangent/page2 -- tangent --> /tangent/returner -- return --> /tangent/page2
+
+    $sel->open_ok("/tangent/page2");
+    $sel->do_command_ok("clickAndWait", "to-returner");
+    like $sel->get_location, qr{/tangent/returner}, "URL looks like /tangent/returner";
+    $sel->do_command_ok("clickAndWait", "returner");
+    like $sel->get_location, qr{/tangent/page2}, "URL looks like /tangent/page2j";
+}
+
+{
+    # /tangent/page3 -- hyperlink --> /tangent/returner -- return --> /
+
+    $sel->open_ok("/tangent/page3");
+    $sel->do_command_ok("clickAndWait", "to-returner");
+    like $sel->get_location, qr{/tangent/returner}, "URL looks like /tangent/returner";
+    $sel->do_command_ok("clickAndWait", "returner");
+    like $sel->get_location, qr{/}, "URL looks like /";
+}
+
+$sel->stop;


More information about the Jifty-commit mailing list