[Jifty-commit] r5150 - in jifty/branches/jquery/t/TestApp-JiftyJS: lib/TestApp/JiftyJS
Jifty commits
jifty-commit at lists.jifty.org
Wed Feb 20 19:06:58 EST 2008
Author: gugod
Date: Wed Feb 20 19:06:56 2008
New Revision: 5150
Modified:
jifty/branches/jquery/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm
jifty/branches/jquery/t/TestApp-JiftyJS/t/1-jifty-update.t
Log:
Test the property that, for a region update with Jifty.update(),
javascript should always be eval-ed after HTML.
Modified: jifty/branches/jquery/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm
==============================================================================
--- jifty/branches/jquery/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm (original)
+++ jifty/branches/jquery/t/TestApp-JiftyJS/lib/TestApp/JiftyJS/View.pm Wed Feb 20 19:06:56 2008
@@ -230,4 +230,43 @@
p { "Redirected!" }
};
+template '/p/zero' => page {
+ render_region("__page", path => "/p/one");
+};
+
+template '/p/one' => sub {
+ p {
+ outs "FooBar.";
+ hyperlink(
+ label => "Two",
+ onclick => {
+ replace_with => '/p/two'
+ },
+ as_button => 1
+ );
+ }
+};
+
+template '/p/two' => sub {
+ hyperlink(
+ label => "Two",
+ onclick => {
+ refresh_self => 1,
+ },
+ as_button => 1
+ );
+ p { "Lorem Ipsum... " } for 1..100;
+
+ outs_raw(<<E);
+ <script type="text/javascript">
+ jQuery(function() {
+ alert( jQuery("p").size() );
+ });
+ </script>
+E
+
+
+};
+
+
1;
Modified: jifty/branches/jquery/t/TestApp-JiftyJS/t/1-jifty-update.t
==============================================================================
--- jifty/branches/jquery/t/TestApp-JiftyJS/t/1-jifty-update.t (original)
+++ jifty/branches/jquery/t/TestApp-JiftyJS/t/1-jifty-update.t Wed Feb 20 19:06:56 2008
@@ -4,7 +4,7 @@
use warnings;
use lib 't/lib';
use Jifty::SubTest;
-use Jifty::Test tests => 26;
+use Jifty::Test tests => 29;
use Jifty::Test::WWW::Selenium;
use utf8;
@@ -64,5 +64,16 @@
$sel->wait_for_text_present_ok("Hello, Pony");
}
-$sel->stop;
+{
+ # Make sure there's 100 <p> element.
+ # For any region update, using Jifty.udpate(), javascript code in there are always executed
+ # after HTML is all done. This is to test how many <p> elements the javascript code
+ # can get. And ithe number should be 100.
+ $sel->open_ok('/p/zero');
+ $sel->click_ok('xpath=//input');
+ $sel->pause();
+ my $msg = $sel->get_alert();
+ is($msg, "100");
+}
+$sel->stop;
More information about the Jifty-commit
mailing list