Repository: wicket
Updated Branches:
  refs/heads/master 7904ae1c6 -> 080df220c


WICKET-6529: added testcase


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/080df220
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/080df220
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/080df220

Branch: refs/heads/master
Commit: 080df220c5a2ed8ccf90fde90e9469525f259ecc
Parents: 7904ae1
Author: Emond Papegaaij <[email protected]>
Authored: Mon Feb 5 13:55:48 2018 +0100
Committer: Emond Papegaaij <[email protected]>
Committed: Mon Feb 5 13:55:48 2018 +0100

----------------------------------------------------------------------
 .../stateless/StatelessPageWithFeedback.html    | 15 +++++
 .../stateless/StatelessPageWithFeedback.java    | 50 +++++++++++++++++
 .../StatelessPageWithFeedbackTest.java          | 59 ++++++++++++++++++++
 3 files changed, 124 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/080df220/wicket-core/src/test/java/org/apache/wicket/stateless/StatelessPageWithFeedback.html
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/stateless/StatelessPageWithFeedback.html
 
b/wicket-core/src/test/java/org/apache/wicket/stateless/StatelessPageWithFeedback.html
new file mode 100644
index 0000000..4ff2fb8
--- /dev/null
+++ 
b/wicket-core/src/test/java/org/apache/wicket/stateless/StatelessPageWithFeedback.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html xmlns:wicket="http://wicket.apache.org";>
+       <head>
+               <meta charset="utf-8" />
+               <title>Apache Wicket Quickstart</title>
+               <link 
href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:regular,bold' 
rel='stylesheet' type='text/css' />
+               <link rel="stylesheet" href="style.css" type="text/css" 
media="screen" title="Stylesheet" />
+       </head>
+       <body>
+               <div wicket:id="feedback"></div>
+               <form wicket:id="form">
+                       <button type="submit" wicket:id="submit">Test</button>
+               </form>
+       </body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/080df220/wicket-core/src/test/java/org/apache/wicket/stateless/StatelessPageWithFeedback.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/stateless/StatelessPageWithFeedback.java
 
b/wicket-core/src/test/java/org/apache/wicket/stateless/StatelessPageWithFeedback.java
new file mode 100644
index 0000000..8b0fff6
--- /dev/null
+++ 
b/wicket-core/src/test/java/org/apache/wicket/stateless/StatelessPageWithFeedback.java
@@ -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.stateless;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.form.StatelessForm;
+import org.apache.wicket.markup.html.form.SubmitLink;
+import org.apache.wicket.markup.html.panel.FeedbackPanel;
+
+/**
+ * @author papegaaij
+ */
+public class StatelessPageWithFeedback extends WebPage {
+       private static final long serialVersionUID = 1L;
+
+       @Override
+       protected void onInitialize() {
+               super.onInitialize();
+
+               setStatelessHint(true);
+
+               error("error in onInitialize");
+
+               add(new FeedbackPanel("feedback"));
+               StatelessForm<Void> form = new StatelessForm<Void>("form");
+               add(form);
+               form.add(new SubmitLink("submit") {
+                       private static final long serialVersionUID = 1L;
+
+                       @Override
+                       public void onSubmit() {
+                               StatelessPageWithFeedback.this.error("error in 
onSubmit");
+                       }
+               });
+       }
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/080df220/wicket-core/src/test/java/org/apache/wicket/stateless/StatelessPageWithFeedbackTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/stateless/StatelessPageWithFeedbackTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/stateless/StatelessPageWithFeedbackTest.java
new file mode 100644
index 0000000..16eeda9
--- /dev/null
+++ 
b/wicket-core/src/test/java/org/apache/wicket/stateless/StatelessPageWithFeedbackTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.stateless;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.mock.MockApplication;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.util.tester.WicketTestCase;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Simple test using the WicketTester
+ */
+public class StatelessPageWithFeedbackTest extends WicketTestCase
+{
+       @Override
+       protected WebApplication newApplication()
+       {
+               return new MockApplication()
+               {
+                       @Override
+                       public Class<? extends Page> getHomePage()
+                       {
+                               return StatelessPageWithFeedback.class;
+                       }
+               };
+       }
+
+       /**
+        * After submit, both feedbackmessages (from onInitialize and onSubmit) 
must be visible
+        */
+       @Test
+       @Ignore("WICKET-6529 is not fixed")
+       public void wicket6529()
+       {
+               tester.startPage(StatelessPageWithFeedback.class);
+               tester.assertFeedback("feedback", "error in onInitialize");
+               tester.clickLink("form:submit");
+               String response = tester.getLastResponseAsString();
+               Assert.assertTrue("onInitialize", response.contains("error in 
onInitialize"));
+               Assert.assertTrue("onSubmit", response.contains("error in 
onSubmit"));
+       }
+}

Reply via email to