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 2013/11/25 21:11:17 UTC
[1/5] git commit: Fix test that fails using jQuery as infrastructure
Updated Branches:
refs/heads/master b6d1bdeba -> 09bd34c8b
Fix test that fails using jQuery as infrastructure
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/9ce2d4e7
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/9ce2d4e7
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/9ce2d4e7
Branch: refs/heads/master
Commit: 9ce2d4e7c1a0142c9e351f3f201b2fe8cc5010d6
Parents: b6d1bde
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Nov 25 10:33:05 2013 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Nov 25 10:33:05 2013 -0800
----------------------------------------------------------------------
.../src/test/app1/NestedFormFragment.tml | 18 ++++------------
.../tapestry5/integration/app1/AjaxTests.java | 9 ++------
.../app1/pages/NestedFormFragment.java | 22 +-------------------
3 files changed, 7 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9ce2d4e7/tapestry-core/src/test/app1/NestedFormFragment.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/NestedFormFragment.tml b/tapestry-core/src/test/app1/NestedFormFragment.tml
index fe41262..2922e14 100644
--- a/tapestry-core/src/test/app1/NestedFormFragment.tml
+++ b/tapestry-core/src/test/app1/NestedFormFragment.tml
@@ -7,25 +7,15 @@
<t:form>
<t:formfragment t:id="outerhide" visible="true" class="well">
<div id="outertext1">Outer Text -- nested in outerhide</div>
+ <label class="checkbox">
+ <t:checkbox t:id="innertrigger1" value="true" t:mixins="triggerfragment" fragment="innerhide"/>
+ Trigger hide/reveal of innerhide
+ </label>
<t:formfragment t:id="innerhide" visible="true">
<div id="innertext1">Inner Text -- nested in innerhide</div>
- <label class="checkbox">
- <t:checkbox t:id="innertrigger1" value="true" t:mixins="triggerfragment" fragment="innerhide"/>
- Trigger hide/reveal of innerhide
- </label>
</t:formfragment>
</t:formfragment>
- <t:formfragment t:id="outerremove" visible="true" class="well">
- <div id="outertext2">Outer Text -- nested in outerremove</div>
- <t:formfragment t:id="innerremove" visible="true">
- <div id="innertext2">Inner Text -- nested in innerremove</div>
- <label class="checkbox">
- <t:checkbox t:id="innertrigger2" value="true"/>
- Does nothing ... looks like this was not fully implemented.
- </label>
- </t:formfragment>
- </t:formfragment>
</t:form>
</t:border>
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9ce2d4e7/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
index 41f8673..17cb399 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java
@@ -88,16 +88,11 @@ public class AjaxTests extends App1TestCase
assertTrue(isVisible("outertext1"));
assertTrue(isVisible("innertext1"));
assertTrue(isChecked("innertrigger1"));
+
click("innertrigger1");
assertTrue(isVisible("outertext1"));
-
- //now make sure that hide_and_remove is properly handled, as well...
- assertTrue(isVisible("outertext2"));
- assertTrue(isVisible("innertext2"));
-
- // Looks like at one time there was work to have a trigger that removed the fragment entirely,
- // not just hide/reveal it, but that seems to have been lost.
+ assertFalse(isVisible("innertext1"));
}
/**
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/9ce2d4e7/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/NestedFormFragment.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/NestedFormFragment.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/NestedFormFragment.java
index f5d6f5f..b90f4fe 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/NestedFormFragment.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/NestedFormFragment.java
@@ -1,26 +1,6 @@
package org.apache.tapestry5.integration.app1.pages;
-import org.apache.tapestry5.ioc.annotations.Inject;
-import org.apache.tapestry5.annotations.InjectComponent;
-import org.apache.tapestry5.annotations.Property;
-import org.apache.tapestry5.corelib.components.Checkbox;
-import org.apache.tapestry5.corelib.components.FormFragment;
-import org.apache.tapestry5.services.javascript.JavaScriptSupport;
-
-public class NestedFormFragment
+public class NestedFormFragment
{
- @InjectComponent
- private FormFragment innerremove;
-
- @InjectComponent
- private Checkbox innertrigger2;
-
- @Inject
- private JavaScriptSupport jsSupport;
-
- void afterRender()
- {
- jsSupport.addScript("$('%s').observe('click', function() { $('%s').fire(Tapestry.HIDE_AND_REMOVE_EVENT); });", innertrigger2.getClientId(), innerremove.getClientId());
- }
}
[2/5] git commit: Switch default for tests from "prototype" to
"jquery"
Posted by hl...@apache.org.
Switch default for tests from "prototype" to "jquery"
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/dd0a2735
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/dd0a2735
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/dd0a2735
Branch: refs/heads/master
Commit: dd0a27359e99d976fbe45a10554f647ab23ec97c
Parents: 9ce2d4e
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Nov 25 10:45:08 2013 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Nov 25 10:45:08 2013 -0800
----------------------------------------------------------------------
.../org/apache/tapestry5/integration/app1/services/AppModule.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/dd0a2735/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
index f095270..0f5a5b7 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
@@ -147,6 +147,9 @@ public class AppModule
configuration.add("app.injected-symbol", "Symbol contributed to ApplicationDefaults");
configuration.add(SymbolConstants.HMAC_PASSPHRASE, "testing, testing, 1... 2... 3...");
+
+ // This is the emphasis of testing at this point.
+ configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, "jquery");
}
public static void contributeIgnoredPathsFilter(Configuration<String> configuration)
[4/5] git commit: Fix incorrect return value from the jQuery version
of ElementWrapper:trigger()
Posted by hl...@apache.org.
Fix incorrect return value from the jQuery version of ElementWrapper:trigger()
The result was inverted; one side-effect is that forms that contained input validations would round-trip to the server anyway.
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/f270cbc9
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/f270cbc9
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/f270cbc9
Branch: refs/heads/master
Commit: f270cbc918b0721ca4b971bb6d61b4556dfd52e0
Parents: a5de2b6
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Nov 25 12:10:45 2013 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Nov 25 12:10:45 2013 -0800
----------------------------------------------------------------------
.../org/apache/tapestry5/t5-core-dom.coffee | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f270cbc9/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
index f1a7afb..2cec0cc 100644
--- a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
+++ b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
@@ -117,8 +117,8 @@ define ["underscore", "./utils", "./events", "jquery"],
# as well as DOM event bubbling.
stop: ->
#if jquery
- @nativeEvent.stopImmediatePropagation()
@nativeEvent.preventDefault()
+ @nativeEvent.stopImmediatePropagation()
#elseif prototype
@nativeEvent.stop()
#endif
@@ -538,8 +538,7 @@ define ["underscore", "./utils", "./events", "jquery"],
@$.trigger jqEvent, memo
- # Not sure if this is sufficient to ensure that event was cancelled:
- return jqEvent.isImmediatePropagationStopped()
+ return not jqEvent.isImmediatePropagationStopped()
#elseif prototype
if (eventName.indexOf ':') > 0
# Custom event is supported directly by Prototype:
[3/5] git commit: More corrections to fix tests broken when using
jQuery infrastructure
Posted by hl...@apache.org.
More corrections to fix tests broken when using jQuery infrastructure
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a5de2b69
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a5de2b69
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a5de2b69
Branch: refs/heads/master
Commit: a5de2b69edc7be63328d056d94e933e16dfdcaf0
Parents: dd0a273
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Nov 25 11:14:50 2013 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Nov 25 11:14:50 2013 -0800
----------------------------------------------------------------------
.../META-INF/modules/app/test-support.coffee | 14 ++++++++++++++
.../integration/app1/components/Border.java | 4 ++--
.../META-INF/assets/ExpressionInJsFunction.js | 16 ++++++++++------
.../apache/tapestry5/test/SeleniumTestCase.java | 19 ++++++++++++++-----
4 files changed, 40 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a5de2b69/tapestry-core/src/test/coffeescript/META-INF/modules/app/test-support.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/coffeescript/META-INF/modules/app/test-support.coffee b/tapestry-core/src/test/coffeescript/META-INF/modules/app/test-support.coffee
new file mode 100644
index 0000000..ffbb583
--- /dev/null
+++ b/tapestry-core/src/test/coffeescript/META-INF/modules/app/test-support.coffee
@@ -0,0 +1,14 @@
+# Provide test support functions that can be addressed via Selenium.
+
+# TODO: Maybe move this to main, for external re-use?
+
+define ["t5/core/dom"],
+ (dom) ->
+
+ exports =
+ findCSSMatchCount: (selector) -> dom.body.find(selector).length
+ doesNotExist: (elementId) -> (dom elementId) is null
+
+ window.testSupport = exports
+
+ return exports
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a5de2b69/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
index 404f46c..ef117a1 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2011 The Apache Software Foundation
+// Copyright 2006-2013 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import org.apache.tapestry5.services.Request;
* Here's a component with a template, including a t:body element. Really should rename this to "Layout" as that's the
* T5 naming.
*/
-@Import(stylesheet = "context:css/app.css", module = "bootstrap/collapse")
+@Import(stylesheet = "context:css/app.css", module = {"bootstrap/collapse", "app/test-support"})
public class Border
{
@Inject
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a5de2b69/tapestry-core/src/test/resources/META-INF/assets/ExpressionInJsFunction.js
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/resources/META-INF/assets/ExpressionInJsFunction.js b/tapestry-core/src/test/resources/META-INF/assets/ExpressionInJsFunction.js
index da27472..d4116c3 100644
--- a/tapestry-core/src/test/resources/META-INF/assets/ExpressionInJsFunction.js
+++ b/tapestry-core/src/test/resources/META-INF/assets/ExpressionInJsFunction.js
@@ -1,7 +1,11 @@
-function test_func() {
- $('target').setValue("test1");
-}
+require(["t5/core/dom"], function (dom) {
+
+ window.test_func = function () {
+ dom('target').value("test1");
+ };
+
+ window.test_func_with_map = function () {
+ dom('target').value("{key=test2}");
+ };
+});
-function test_func_with_map() {
- $('target').setValue("{key=test2}");
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a5de2b69/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
----------------------------------------------------------------------
diff --git a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
index e2b6a90..db14829 100644
--- a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
+++ b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
@@ -1458,14 +1458,19 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
/**
* Waits, up to the page load limit for an element (identified by a CSS rule) to exist
* (it is not assured that the element will be visible).
+ * <p/>
+ * This implementation only works if the application provides a function onto the
+ * window object: "testSupport.findCSSMatchCount()" which accepts a CSS rule and returns the number
+ * of matching elements.
*
- * @param cssRule
+ * @param cssSelector
* used to locate the element
* @since 5.3
+ * @deprecated Deprecated in 5.4 with no replacement
*/
- protected void waitForCSSSelectedElementToAppear(String cssRule)
+ protected void waitForCSSSelectedElementToAppear(String cssSelector)
{
- String condition = String.format("window.$$ && window.$$(\"%s\").size() > 0", cssRule);
+ String condition = String.format("window.testSupport.findCSSMatchCount(\"%s\") > 0", cssSelector);
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
}
@@ -1481,7 +1486,7 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
protected final void waitForElementToAppear(String elementId)
{
- String condition = String.format("window.$(\"%s\")", elementId);
+ String condition = String.format("window.getElementById(\"%s\")", elementId);
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
}
@@ -1489,13 +1494,17 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
/**
* Waits for the element to be removed from the DOM.
*
+ * <p/>
+ * This implementation depends on window being extended with testSupport.isNotVisible().
+ *
* @param elementId
* client-side id of element
* @since 5.3
+ * @deprecated Deprecated in 5.4 with no replacement
*/
protected final void waitForElementToDisappear(String elementId)
{
- String condition = String.format("window.$(\"%s\").hide()", elementId);
+ String condition = String.format("window.testSupport.doesNotExist(\"%s\")", elementId);
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
}
[3/5] git commit: More corrections to fix tests broken when using
jQuery infrastructure
Posted by hl...@apache.org.
More corrections to fix tests broken when using jQuery infrastructure
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a5de2b69
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a5de2b69
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a5de2b69
Branch: refs/heads/master
Commit: a5de2b69edc7be63328d056d94e933e16dfdcaf0
Parents: dd0a273
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Nov 25 11:14:50 2013 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Nov 25 11:14:50 2013 -0800
----------------------------------------------------------------------
.../META-INF/modules/app/test-support.coffee | 14 ++++++++++++++
.../integration/app1/components/Border.java | 4 ++--
.../META-INF/assets/ExpressionInJsFunction.js | 16 ++++++++++------
.../apache/tapestry5/test/SeleniumTestCase.java | 19 ++++++++++++++-----
4 files changed, 40 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a5de2b69/tapestry-core/src/test/coffeescript/META-INF/modules/app/test-support.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/coffeescript/META-INF/modules/app/test-support.coffee b/tapestry-core/src/test/coffeescript/META-INF/modules/app/test-support.coffee
new file mode 100644
index 0000000..ffbb583
--- /dev/null
+++ b/tapestry-core/src/test/coffeescript/META-INF/modules/app/test-support.coffee
@@ -0,0 +1,14 @@
+# Provide test support functions that can be addressed via Selenium.
+
+# TODO: Maybe move this to main, for external re-use?
+
+define ["t5/core/dom"],
+ (dom) ->
+
+ exports =
+ findCSSMatchCount: (selector) -> dom.body.find(selector).length
+ doesNotExist: (elementId) -> (dom elementId) is null
+
+ window.testSupport = exports
+
+ return exports
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a5de2b69/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
index 404f46c..ef117a1 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Border.java
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2011 The Apache Software Foundation
+// Copyright 2006-2013 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import org.apache.tapestry5.services.Request;
* Here's a component with a template, including a t:body element. Really should rename this to "Layout" as that's the
* T5 naming.
*/
-@Import(stylesheet = "context:css/app.css", module = "bootstrap/collapse")
+@Import(stylesheet = "context:css/app.css", module = {"bootstrap/collapse", "app/test-support"})
public class Border
{
@Inject
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a5de2b69/tapestry-core/src/test/resources/META-INF/assets/ExpressionInJsFunction.js
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/resources/META-INF/assets/ExpressionInJsFunction.js b/tapestry-core/src/test/resources/META-INF/assets/ExpressionInJsFunction.js
index da27472..d4116c3 100644
--- a/tapestry-core/src/test/resources/META-INF/assets/ExpressionInJsFunction.js
+++ b/tapestry-core/src/test/resources/META-INF/assets/ExpressionInJsFunction.js
@@ -1,7 +1,11 @@
-function test_func() {
- $('target').setValue("test1");
-}
+require(["t5/core/dom"], function (dom) {
+
+ window.test_func = function () {
+ dom('target').value("test1");
+ };
+
+ window.test_func_with_map = function () {
+ dom('target').value("{key=test2}");
+ };
+});
-function test_func_with_map() {
- $('target').setValue("{key=test2}");
-}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a5de2b69/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
----------------------------------------------------------------------
diff --git a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
index e2b6a90..db14829 100644
--- a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
+++ b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
@@ -1458,14 +1458,19 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
/**
* Waits, up to the page load limit for an element (identified by a CSS rule) to exist
* (it is not assured that the element will be visible).
+ * <p/>
+ * This implementation only works if the application provides a function onto the
+ * window object: "testSupport.findCSSMatchCount()" which accepts a CSS rule and returns the number
+ * of matching elements.
*
- * @param cssRule
+ * @param cssSelector
* used to locate the element
* @since 5.3
+ * @deprecated Deprecated in 5.4 with no replacement
*/
- protected void waitForCSSSelectedElementToAppear(String cssRule)
+ protected void waitForCSSSelectedElementToAppear(String cssSelector)
{
- String condition = String.format("window.$$ && window.$$(\"%s\").size() > 0", cssRule);
+ String condition = String.format("window.testSupport.findCSSMatchCount(\"%s\") > 0", cssSelector);
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
}
@@ -1481,7 +1486,7 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
protected final void waitForElementToAppear(String elementId)
{
- String condition = String.format("window.$(\"%s\")", elementId);
+ String condition = String.format("window.getElementById(\"%s\")", elementId);
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
}
@@ -1489,13 +1494,17 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
/**
* Waits for the element to be removed from the DOM.
*
+ * <p/>
+ * This implementation depends on window being extended with testSupport.isNotVisible().
+ *
* @param elementId
* client-side id of element
* @since 5.3
+ * @deprecated Deprecated in 5.4 with no replacement
*/
protected final void waitForElementToDisappear(String elementId)
{
- String condition = String.format("window.$(\"%s\").hide()", elementId);
+ String condition = String.format("window.testSupport.doesNotExist(\"%s\")", elementId);
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
}
[2/5] git commit: Switch default for tests from "prototype" to
"jquery"
Posted by hl...@apache.org.
Switch default for tests from "prototype" to "jquery"
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/dd0a2735
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/dd0a2735
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/dd0a2735
Branch: refs/heads/master
Commit: dd0a27359e99d976fbe45a10554f647ab23ec97c
Parents: 9ce2d4e
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Nov 25 10:45:08 2013 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Nov 25 10:45:08 2013 -0800
----------------------------------------------------------------------
.../org/apache/tapestry5/integration/app1/services/AppModule.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/dd0a2735/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
index f095270..0f5a5b7 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
@@ -147,6 +147,9 @@ public class AppModule
configuration.add("app.injected-symbol", "Symbol contributed to ApplicationDefaults");
configuration.add(SymbolConstants.HMAC_PASSPHRASE, "testing, testing, 1... 2... 3...");
+
+ // This is the emphasis of testing at this point.
+ configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, "jquery");
}
public static void contributeIgnoredPathsFilter(Configuration<String> configuration)
[5/5] git commit: Fix some more test-suite problems related to using
jQuery
Posted by hl...@apache.org.
Fix some more test-suite problems related to using jQuery
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/09bd34c8
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/09bd34c8
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/09bd34c8
Branch: refs/heads/master
Commit: 09bd34c8bd1e735e340bdbac276d2b7810492cb6
Parents: f270cbc
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Nov 25 12:11:08 2013 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Nov 25 12:11:08 2013 -0800
----------------------------------------------------------------------
.../tapestry5/integration/app1/FormTests.java | 19 +++++++++++++------
.../apache/tapestry5/test/SeleniumTestCase.java | 6 +++---
2 files changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/09bd34c8/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
index 1928318..5a7732e 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
@@ -241,16 +241,19 @@ public class FormTests extends App1TestCase
//move to the next month.
click("css=button.nextButton");
+
//first, make sure that NOTHING shows as selected! The selected date is still 5/28/46
- String selectedGoneCondition = "window.$$(\"td.selected\").size() == 0";
- waitForCondition(selectedGoneCondition, PAGE_LOAD_TIMEOUT);
+
+ waitForSelectedToBeRemoved();
+
//make sure it's still selected if we navigate back...
click("css=button.previousButton");
waitForCSSSelectedElementToAppear("td.selected");
click("css=button.nextButton");
- waitForCondition(selectedGoneCondition, PAGE_LOAD_TIMEOUT);
+
+ waitForSelectedToBeRemoved();
click("xpath=//td[text()='28']");
String pickerGoneSelector = "css=div.datePicker";
@@ -280,7 +283,8 @@ public class FormTests extends App1TestCase
waitForCSSSelectedElementToAppear("div.datePicker");
click("css=button.nextButton");
- waitForCondition(selectedGoneCondition, PAGE_LOAD_TIMEOUT);
+
+ waitForSelectedToBeRemoved();
click("css=div.datePicker .footerTable button");
waitForCSSSelectedElementToAppear("td.selected");
@@ -315,6 +319,11 @@ public class FormTests extends App1TestCase
assertFieldValue("asteroidImpact", "");
}
+ private void waitForSelectedToBeRemoved()
+ {
+ waitForCondition("selenium.browserbot.getCurrentWindow().testSupport.findCSSMatchCount('td.selected') == 0", PAGE_LOAD_TIMEOUT);
+ }
+
// TAP4-1408
@Test
public void datefield_clickoutside_closes()
@@ -806,8 +815,6 @@ public class FormTests extends App1TestCase
{
openLinks("LinkSubmit Demo");
- waitForElementToAppear("fred");
-
click("//a[@id='fred']");
assertTextPresent("You must provide a value for Name.");
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/09bd34c8/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
----------------------------------------------------------------------
diff --git a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
index db14829..1aee01a 100644
--- a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
+++ b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
@@ -1470,7 +1470,7 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
*/
protected void waitForCSSSelectedElementToAppear(String cssSelector)
{
- String condition = String.format("window.testSupport.findCSSMatchCount(\"%s\") > 0", cssSelector);
+ String condition = String.format("selenium.browserbot.getCurrentWindow().testSupport.findCSSMatchCount(\"%s\") > 0", cssSelector);
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
}
@@ -1486,7 +1486,7 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
protected final void waitForElementToAppear(String elementId)
{
- String condition = String.format("window.getElementById(\"%s\")", elementId);
+ String condition = String.format("selenium.browserbot.getCurrentWindow().document.getElementById(\"%s\")", elementId);
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
}
@@ -1504,7 +1504,7 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
*/
protected final void waitForElementToDisappear(String elementId)
{
- String condition = String.format("window.testSupport.doesNotExist(\"%s\")", elementId);
+ String condition = String.format("selenium.browserbot.getCurrentWindow().testSupport.doesNotExist(\"%s\")", elementId);
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
}
[4/5] git commit: Fix incorrect return value from the jQuery version
of ElementWrapper:trigger()
Posted by hl...@apache.org.
Fix incorrect return value from the jQuery version of ElementWrapper:trigger()
The result was inverted; one side-effect is that forms that contained input validations would round-trip to the server anyway.
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/f270cbc9
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/f270cbc9
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/f270cbc9
Branch: refs/heads/master
Commit: f270cbc918b0721ca4b971bb6d61b4556dfd52e0
Parents: a5de2b6
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Nov 25 12:10:45 2013 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Nov 25 12:10:45 2013 -0800
----------------------------------------------------------------------
.../org/apache/tapestry5/t5-core-dom.coffee | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f270cbc9/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
index f1a7afb..2cec0cc 100644
--- a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
+++ b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
@@ -117,8 +117,8 @@ define ["underscore", "./utils", "./events", "jquery"],
# as well as DOM event bubbling.
stop: ->
#if jquery
- @nativeEvent.stopImmediatePropagation()
@nativeEvent.preventDefault()
+ @nativeEvent.stopImmediatePropagation()
#elseif prototype
@nativeEvent.stop()
#endif
@@ -538,8 +538,7 @@ define ["underscore", "./utils", "./events", "jquery"],
@$.trigger jqEvent, memo
- # Not sure if this is sufficient to ensure that event was cancelled:
- return jqEvent.isImmediatePropagationStopped()
+ return not jqEvent.isImmediatePropagationStopped()
#elseif prototype
if (eventName.indexOf ':') > 0
# Custom event is supported directly by Prototype:
[5/5] git commit: Fix some more test-suite problems related to using
jQuery
Posted by hl...@apache.org.
Fix some more test-suite problems related to using jQuery
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/09bd34c8
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/09bd34c8
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/09bd34c8
Branch: refs/heads/master
Commit: 09bd34c8bd1e735e340bdbac276d2b7810492cb6
Parents: f270cbc
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Nov 25 12:11:08 2013 -0800
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Nov 25 12:11:08 2013 -0800
----------------------------------------------------------------------
.../tapestry5/integration/app1/FormTests.java | 19 +++++++++++++------
.../apache/tapestry5/test/SeleniumTestCase.java | 6 +++---
2 files changed, 16 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/09bd34c8/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
index 1928318..5a7732e 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java
@@ -241,16 +241,19 @@ public class FormTests extends App1TestCase
//move to the next month.
click("css=button.nextButton");
+
//first, make sure that NOTHING shows as selected! The selected date is still 5/28/46
- String selectedGoneCondition = "window.$$(\"td.selected\").size() == 0";
- waitForCondition(selectedGoneCondition, PAGE_LOAD_TIMEOUT);
+
+ waitForSelectedToBeRemoved();
+
//make sure it's still selected if we navigate back...
click("css=button.previousButton");
waitForCSSSelectedElementToAppear("td.selected");
click("css=button.nextButton");
- waitForCondition(selectedGoneCondition, PAGE_LOAD_TIMEOUT);
+
+ waitForSelectedToBeRemoved();
click("xpath=//td[text()='28']");
String pickerGoneSelector = "css=div.datePicker";
@@ -280,7 +283,8 @@ public class FormTests extends App1TestCase
waitForCSSSelectedElementToAppear("div.datePicker");
click("css=button.nextButton");
- waitForCondition(selectedGoneCondition, PAGE_LOAD_TIMEOUT);
+
+ waitForSelectedToBeRemoved();
click("css=div.datePicker .footerTable button");
waitForCSSSelectedElementToAppear("td.selected");
@@ -315,6 +319,11 @@ public class FormTests extends App1TestCase
assertFieldValue("asteroidImpact", "");
}
+ private void waitForSelectedToBeRemoved()
+ {
+ waitForCondition("selenium.browserbot.getCurrentWindow().testSupport.findCSSMatchCount('td.selected') == 0", PAGE_LOAD_TIMEOUT);
+ }
+
// TAP4-1408
@Test
public void datefield_clickoutside_closes()
@@ -806,8 +815,6 @@ public class FormTests extends App1TestCase
{
openLinks("LinkSubmit Demo");
- waitForElementToAppear("fred");
-
click("//a[@id='fred']");
assertTextPresent("You must provide a value for Name.");
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/09bd34c8/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
----------------------------------------------------------------------
diff --git a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
index db14829..1aee01a 100644
--- a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
+++ b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
@@ -1470,7 +1470,7 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
*/
protected void waitForCSSSelectedElementToAppear(String cssSelector)
{
- String condition = String.format("window.testSupport.findCSSMatchCount(\"%s\") > 0", cssSelector);
+ String condition = String.format("selenium.browserbot.getCurrentWindow().testSupport.findCSSMatchCount(\"%s\") > 0", cssSelector);
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
}
@@ -1486,7 +1486,7 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
protected final void waitForElementToAppear(String elementId)
{
- String condition = String.format("window.getElementById(\"%s\")", elementId);
+ String condition = String.format("selenium.browserbot.getCurrentWindow().document.getElementById(\"%s\")", elementId);
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
}
@@ -1504,7 +1504,7 @@ public abstract class SeleniumTestCase extends Assert implements Selenium
*/
protected final void waitForElementToDisappear(String elementId)
{
- String condition = String.format("window.testSupport.doesNotExist(\"%s\")", elementId);
+ String condition = String.format("selenium.browserbot.getCurrentWindow().testSupport.doesNotExist(\"%s\")", elementId);
waitForCondition(condition, PAGE_LOAD_TIMEOUT);
}