You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2010/09/08 18:32:46 UTC
svn commit: r995122 - in
/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form:
AjaxFormSubmitBehaviorTest.java AjaxFormSubmitBehaviorTestPage.html
AjaxFormSubmitBehaviorTestPage.java
Author: ivaynberg
Date: Wed Sep 8 16:32:46 2010
New Revision: 995122
URL: http://svn.apache.org/viewvc?rev=995122&view=rev
Log:
testcase
Issue: WICKET-1743
Added:
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTest.java (with props)
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTestPage.html (with props)
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTestPage.java (with props)
Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTest.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTest.java?rev=995122&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTest.java (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTest.java Wed Sep 8 16:32:46 2010
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.ajax.form;
+
+import junit.framework.TestCase;
+
+import org.apache.wicket.util.tester.WicketTester;
+
+/**
+ * Test case for WICKET-1743
+ *
+ * @see <a href="https://issues.apache.org/jira/browse/WICKET-1743">WICKET-1743</a>
+ */
+public class AjaxFormSubmitBehaviorTest extends TestCase
+{
+ private WicketTester tester;
+
+ @Override
+ public void setUp()
+ {
+ tester = new WicketTester();
+ }
+
+ public void testAjaxFormSubmitBehavior()
+ {
+ // start and render the test page
+ tester.startPage(AjaxFormSubmitBehaviorTestPage.class);
+ // assert rendered page class
+ tester.assertRenderedPage(AjaxFormSubmitBehaviorTestPage.class);
+ // assert rendered page class
+ AjaxFormSubmitBehaviorTestPage homePage = (AjaxFormSubmitBehaviorTestPage)tester.getLastRenderedPage();
+ TestForm testForm = homePage.getForm();
+ tester.executeAjaxEvent(testForm.getTextField(), "onchange");
+ assertTrue(testForm.isSubmitedByAjaxBehavior());
+ }
+}
\ No newline at end of file
Propchange: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTestPage.html
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTestPage.html?rev=995122&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTestPage.html (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTestPage.html Wed Sep 8 16:32:46 2010
@@ -0,0 +1,10 @@
+<html>
+ <body>
+ <form wicket:id="form">
+ <input type="text" wicket:id="textField" />
+ <a wicket:id="ajaxSubmitLink"></a>
+ <input type="submit" wicket:id="submit" value="Submit"/>
+ </form>
+ </body>
+</html>
+
Propchange: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTestPage.html
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTestPage.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTestPage.java?rev=995122&view=auto
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTestPage.java (added)
+++ wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTestPage.java Wed Sep 8 16:32:46 2010
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.ajax.form;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.form.Button;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.SubmitLink;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.model.Model;
+
+/**
+ * Homepage
+ */
+public class AjaxFormSubmitBehaviorTestPage extends WebPage
+{
+ private static final long serialVersionUID = 1L;
+ private final TestForm form;
+
+ public AjaxFormSubmitBehaviorTestPage()
+ {
+ add(form = new TestForm("form"));
+ }
+
+ public TestForm getForm()
+ {
+ return form;
+ }
+}
+
+class TestForm extends Form<Void>
+{
+ private static final long serialVersionUID = 1L;
+ private final Button submitButton;
+ private final TextField textField;
+ private boolean submitedByAjaxBehavior;
+
+ public TestForm(String id)
+ {
+ super(id);
+ textField = new TextField("textField", new Model());
+ textField.add(new AjaxFormSubmitBehavior("onchange")
+ {
+ @Override
+ protected void onError(AjaxRequestTarget target)
+ {
+ }
+
+ @Override
+ protected void onSubmit(AjaxRequestTarget target)
+ {
+ submitedByAjaxBehavior = true;
+ }
+ });
+ add(textField);
+ add(new SubmitLink("ajaxSubmitLink")
+ {
+ @Override
+ public void onSubmit()
+ {
+ throw new IllegalStateException("Submit link hit!");
+ }
+ });
+
+ add((submitButton = new Button("submit")
+ {
+
+ @Override
+ public void onSubmit()
+ {
+ throw new IllegalStateException("Submit button hit!");
+ }
+ }));
+ }
+
+
+ /**
+ * @return the textField
+ */
+ public TextField getTextField()
+ {
+ return textField;
+ }
+
+
+ /**
+ * @return the submitedByAjaxBehavior
+ */
+ public boolean isSubmitedByAjaxBehavior()
+ {
+ return submitedByAjaxBehavior;
+ }
+
+}
\ No newline at end of file
Propchange: wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehaviorTestPage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain