You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2012/12/06 01:29:14 UTC
[8/10] git commit: Restore lost functionality for ZoneDemo page:
triggering a DOM update when a zone updates Fix broken tests
Restore lost functionality for ZoneDemo page: triggering a DOM update when a zone updates
Fix broken tests
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a506b2ff
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a506b2ff
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a506b2ff
Branch: refs/heads/5.4-js-rewrite
Commit: a506b2ff36fda2ea15111664f75c3ae9eb1481f3
Parents: b2fefe7
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Wed Dec 5 15:00:04 2012 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Wed Dec 5 15:00:04 2012 -0800
----------------------------------------------------------------------
.../integration/app1/pages/zonedemo.coffee | 5 ++++
.../tapestry5/integration/app1/ZoneTests.java | 18 ++++++++++++--
.../integration/app1/pages/nested/ZoneDemo.java | 5 +---
3 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a506b2ff/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/zonedemo.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/zonedemo.coffee b/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/zonedemo.coffee
new file mode 100644
index 0000000..ba28623
--- /dev/null
+++ b/tapestry-core/src/test/coffeescript/org/apache/tapestry5/integration/app1/pages/zonedemo.coffee
@@ -0,0 +1,5 @@
+require ["core/dom", "core/events"],
+ (dom, events) ->
+
+ dom.onDocument events.zone.didUpdate, ->
+ (dom "zone-update-message").update "Zone updated."
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a506b2ff/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
index afaeecf..aea3146 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java
@@ -44,9 +44,9 @@ public class ZoneTests extends TapestryCoreTestCase
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
- assertText(String.format("//div[@class='%s']/span", "t-error-popup"), "You must provide a value for Car Model.");
+ assertTextPresent("You must provide a value for Car Model.");
- String selectLocator = "//div[@id='modelZone']//select";
+ String selectLocator = "css=div#modelZone select";
select(selectLocator, "7 Series");
@@ -74,6 +74,8 @@ public class ZoneTests extends TapestryCoreTestCase
{
openLinks("Zone Demo");
+ waitForPageInitialized();
+
assertTextPresent("No name has been selected.");
// Hate doing this, but selecting by the text isn't working, perhaps
@@ -110,13 +112,15 @@ public class ZoneTests extends TapestryCoreTestCase
{
openLinks("Multiple Zone Update Demo");
+ waitForPageInitialized();
+
String now = getText("now");
assertText("wilma", "Wilma Flintstone");
assertText("message", "");
- click("update");
+ click("link=update");
waitForElementToAppear("fredName");
@@ -165,6 +169,8 @@ public class ZoneTests extends TapestryCoreTestCase
{
openLinks("Zone Demo");
+ waitForPageInitialized();
+
assertText("zone-update-message", "");
click("link=Direct JSON response");
@@ -223,6 +229,8 @@ public class ZoneTests extends TapestryCoreTestCase
{
openLinks("Zone/Form Update Demo");
+ waitForPageInitialized();
+
click("link=Update the form");
waitForElementToAppear("updated");
@@ -242,6 +250,8 @@ public class ZoneTests extends TapestryCoreTestCase
{
openLinks("MultiZone Update inside a Form");
+ waitForPageInitialized();
+
select("selectValue1", "3 pre ajax");
waitForElementToAppear("select2ValueZone");
@@ -329,6 +339,8 @@ public class ZoneTests extends TapestryCoreTestCase
{
openLinks("Zone Demo");
+ waitForPageInitialized();
+
assertText("zone-update-message", "");
click("link=Update zone with empty body");
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a506b2ff/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java
index d606274..ea45eeb 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java
@@ -35,6 +35,7 @@ import org.apache.tapestry5.services.javascript.StylesheetOptions;
import java.util.Date;
+@Import(library = "../zonedemo.js")
public class ZoneDemo
{
@Component(id = "registrationForm")
@@ -212,10 +213,6 @@ public class ZoneDemo
void afterRender()
{
jss.importStylesheet(new StylesheetLink(overridesCSS, new StylesheetOptions().asAjaxInsertionPoint()));
-
-// jss.addScript(
-// "$('%s').observe(Tapestry.ZONE_UPDATED_EVENT, function() { $('zone-update-message').update('Zone updated.'); });",
-// output.getClientId());
}
Object onActionFromBadZone()