[Jifty-commit] r4690 - in jifty/trunk/t/TestApp-JiftyJS: share/web/static/css t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Dec 14 05:40:46 EST 2007


Author: gugod
Date: Fri Dec 14 05:40:39 2007
New Revision: 4690

Added:
   jifty/trunk/t/TestApp-JiftyJS/share/web/static/css/
   jifty/trunk/t/TestApp-JiftyJS/share/web/static/css/app.css
Modified:
   jifty/trunk/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm
   jifty/trunk/t/TestApp-JiftyJS/t/1-jifty-update.t

Log:
Add a test to test the link that updates multiple regions at once,
and also showing an alert().


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 05:40:39 2007
@@ -61,6 +61,25 @@
     p { "Region Two" }
 };
 
+template '/region/multiupdate' => page {
+    hyperlink(
+        id => 'update',
+        label => "Update All",
+        onclick => [
+            "alert(42);",
+            { region => 'content1', replace_with => 'region1' },
+            { region => 'content2', replace_with => 'region2' },
+            { region => 'content3', replace_with => 'hello_world', arguments => { name => "Pony" } },
+        ]
+    );
+
+    for (1..3) {
+        with(class=>'column'), div {
+            render_region( name => "content$_" );
+        }
+    }
+    with(style=>"clear:both;"), div {};
+};
 
 # Templtes for testing continuation. Using the example in Jifty::Manual::Continuations
 private template '/c/_first_number_form' => sub {

Added: jifty/trunk/t/TestApp-JiftyJS/share/web/static/css/app.css
==============================================================================
--- (empty file)
+++ jifty/trunk/t/TestApp-JiftyJS/share/web/static/css/app.css	Fri Dec 14 05:40:39 2007
@@ -0,0 +1,8 @@
+
+div.column {
+    width:200px;
+    padding-left:10px;
+    padding-right:10px;
+    float:left;
+}
+

Modified: jifty/trunk/t/TestApp-JiftyJS/t/1-jifty-update.t
==============================================================================
--- jifty/trunk/t/TestApp-JiftyJS/t/1-jifty-update.t	(original)
+++ jifty/trunk/t/TestApp-JiftyJS/t/1-jifty-update.t	Fri Dec 14 05:40:39 2007
@@ -4,15 +4,15 @@
 use warnings;
 use lib 't/lib';
 use Jifty::SubTest;
-use Jifty::Test tests => 12;
+use Jifty::Test tests => 18;
 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;
+my $server = Jifty::Test->make_server;
+my $sel    = Jifty::Test::WWW::Selenium->rc_ok($server);
+my $URL    = $server->started_ok;
 
+{
     $sel->open_ok("/1-jifty-update.html");
     $sel->wait_for_text_present_ok("Jifty.update() tests");
 
@@ -28,7 +28,20 @@
 
     $sel->click_ok("region4");
     $sel->wait_for_text_present_ok("Hello, Smith");
+}
+
+{
+    # One click updates 3 regions, and triggers an alert.
 
-    $sel->stop;
+    $sel->open_ok('/region/multiupdate');
+    $sel->click_ok('update');
+    $sel->get_alert_ok();
+
+    $sel->wait_for_text_present_ok("Region One");
+    $sel->wait_for_text_present_ok("Region Two");
+    $sel->wait_for_text_present_ok("Hello, Pony");
 }
 
+$sel->stop;
+
+


More information about the Jifty-commit mailing list