Repository: tapestry-5 Updated Branches: refs/heads/master 30de6d2c3 -> d9ad274bf
TAP5-2078: don't update the value of a disabled RadioGroup Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/d9ad274b Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/d9ad274b Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/d9ad274b Branch: refs/heads/master Commit: d9ad274bfef6de42d56d055245307c9e07f14373 Parents: 30de6d2 Author: Jochen Kemnade <[email protected]> Authored: Thu Apr 16 11:17:06 2015 +0200 Committer: Jochen Kemnade <[email protected]> Committed: Thu Apr 16 11:17:06 2015 +0200 ---------------------------------------------------------------------- .../corelib/components/RadioGroup.java | 5 ++ tapestry-core/src/test/app1/DisabledFields.tml | 4 ++ .../tapestry5/integration/app1/FormTests.java | 62 +++++++++++--------- .../integration/app1/pages/DisabledFields.java | 10 ++++ 4 files changed, 54 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d9ad274b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RadioGroup.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RadioGroup.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RadioGroup.java index de26640..c7c2d06 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RadioGroup.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/RadioGroup.java @@ -160,6 +160,11 @@ public class RadioGroup implements Field private void processSubmission() { + + if (disabled) + { + return; + } String rawValue = request.getParameter(controlName); tracker.recordInput(this, rawValue); http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d9ad274b/tapestry-core/src/test/app1/DisabledFields.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/app1/DisabledFields.tml b/tapestry-core/src/test/app1/DisabledFields.tml index 5124327..5ace717 100644 --- a/tapestry-core/src/test/app1/DisabledFields.tml +++ b/tapestry-core/src/test/app1/DisabledFields.tml @@ -52,6 +52,10 @@ <t:checklist t:id="checklist" selected="values" disabled="true" encoder="encoder" model="literal:Fred,Barney,Wilma,Betty"/> + <t:radiogroup t:id="radiogroup" value="radiogroupvalue" disabled="true"> + <t:radio value="literal:value1" /> + </t:radiogroup> + <t:submit t:id="submit" disabled="true" value="Disabled Submit"/> <input class="btn btn-default" type="submit" value="Continue"/> </t:form> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d9ad274b/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 fb595cc..32bcf0a 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 @@ -209,7 +209,7 @@ public class FormTests extends App1TestCase assertText("//A[@class='topLabel']", "1966 d\u00e9cembre"); } - + // TAP5-2197 @Test public void datefield_leniency() @@ -218,19 +218,19 @@ public class FormTests extends App1TestCase type("asteroidImpact", "00/00/0000"); type("lenient", "00/00/0000"); - + clickAndWait(SUBMIT); - + // By default, DateField is not lenient anymore assertText("css=div.x-impact p.help-block", "Date value '00/00/0000' is not parseable."); - + // But this one is configured as such by setting the "lenient" parameter to true. assertFalse(isElementPresent("css=div.x-lenient p.help-block")); // Check whether a String coerced to a DateFormat results in a lenient or not instance // according to the SymbolConstants.LENIENT_DATE_FORMAT symbol (default false) assertText("coercedStringToDateFormatLenient", "false"); - + } // TAP5-1057 @@ -377,8 +377,8 @@ public class FormTests extends App1TestCase click("css=div.labelPopup a"); waitForCondition("!selenium.isElementPresent('css=div.labelPopup')", PAGE_LOAD_TIMEOUT); - //It's basically impossible to express "wait until the popup doesn't disappear" - //Instead, we take advantage of knowing that the datepicker disappears with this bug /almost/ + //It's basically impossible to express "wait until the popup doesn't disappear" + //Instead, we take advantage of knowing that the datepicker disappears with this bug /almost/ //immediately after picking the month label, so we sleep the test for a few seconds to provide //ammple time for the bug to manifest. @@ -496,6 +496,9 @@ public class FormTests extends App1TestCase "//input[@name='checklist']", + // TAP5-2078 + "//input[@name='radiogroup']", + "//input[@id='submit_0']"}; for (String path : paths) @@ -506,6 +509,11 @@ public class FormTests extends App1TestCase } assertAttribute("css=div.palette .btn@disabled", "disabled"); + + //TAP5-2078 + clickAndWait("//input[@value='Continue']"); + + assertFalse(isTextPresent("This should not happen")); } /** @@ -867,7 +875,7 @@ public class FormTests extends App1TestCase assertText("name-value", "Betty"); assertText("last-clicked", "Barney"); } - + /** * TAP5-2183 */ @@ -1065,26 +1073,26 @@ public class FormTests extends App1TestCase public void create_select_model_from_objects() throws Exception { openLinks("SelectModel from objects"); - + select("track", "label=The Calling"); - + clickAndWait(SUBMIT); - + assertTextPresent("Selected track: The Calling, Synaesthetic"); } - + @Test public void create_select_model_coercion() throws Exception { openLinks("SelectModel coercion"); - + select("track", "label=The Calling"); - + clickAndWait(SUBMIT); - + assertTextPresent("Selected track: The Calling, Synaesthetic"); } - + @Test public void validation_macro() throws Exception { @@ -1147,7 +1155,7 @@ public class FormTests extends App1TestCase assertTextPresent("Selected colors: [Blue, Red]"); } - + @Test public void checkFormLinkParameters() throws Exception { @@ -1156,7 +1164,7 @@ public class FormTests extends App1TestCase clickAndWait("link=SetValue"); assertTextPresent("Result = '!@#$%^&*()_+='"); - + clickAndWait(SUBMIT); assertTextPresent("Result = '!@#$%^&*()_+='"); } @@ -1183,34 +1191,34 @@ public class FormTests extends App1TestCase public void form_fields_client_id_parameter() { final String[] clientIds = {"clientId-0", "clientId-1"}; - + openLinks("Form Field clientId Parameter Demo"); - + for (int i = 0; i < 4; i++) { - + for (String clientId : clientIds) { assertTrue(selenium.isElementPresent(clientId)); } - + click("updateZone"); waitForAjaxRequestsToComplete(); - + } - + } - + /** TAP5-2301 */ @Test public void select_context() { - + openLinks("MultiZone Update inside a Form"); selenium.select("selectValue1", "label=3 pre ajax"); waitForAjaxRequestsToComplete(); assertEquals( "4 post ajax, number 013, retention policy RUNTIME", selenium.getText("//select[@id='selectValue2']/option")); - + } /** TAP5-1815. In this webapp, HTML5 support is disabled, so we check whether it actually is disabled */ http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d9ad274b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DisabledFields.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DisabledFields.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DisabledFields.java index 6b74fe8..97ea120 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DisabledFields.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DisabledFields.java @@ -93,4 +93,14 @@ public class DisabledFields { return new StringValueEncoder(); } + + public Object getRadioGroupValue() + { + return null; + } + + public void setRadioGroupValue(String value) + { + throw new IllegalStateException("This should not happen"); + } }
