Modified:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/LabelTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/LabelTest.java?rev=1081295&r1=1081294&r2=1081295&view=diff
==============================================================================
---
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/LabelTest.java
(original)
+++
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/LabelTest.java
Mon Mar 14 09:54:09 2011
@@ -1,66 +1,65 @@
-/*
- * $Id$
- *
- * 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.struts2.views.java.simple;
-
-import org.apache.struts2.components.Hidden;
-import org.apache.struts2.components.UIBean;
-import org.apache.struts2.components.Label;
-
-public class LabelTest extends AbstractCommonAttributesTest {
- private Label tag;
-
- public void testRenderLabel() {
- tag.setName("name");
- tag.setValue("val1");
- tag.setId("id1");
- tag.setFor("for_");
- tag.setCssClass("class1");
- tag.setCssStyle("style1");
- tag.setTitle("title");
-
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- String output = writer.getBuffer().toString();
- String expected = s("<label name='name' for='for_' id='id1'
class='class1' style='style1' title='title'>val1</label>");
- assertEquals(expected, output);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.tag = new Label(stack, request, response);
- }
-
- @Override
- protected UIBean getUIBean() {
- return tag;
- }
-
- @Override
- protected String getTagName() {
- return "label";
- }
-}
-
-
-
+/*
+ * $Id$
+ *
+ * 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.struts2.views.java.simple;
+
+import org.apache.struts2.components.Label;
+import org.apache.struts2.components.UIBean;
+
+public class LabelTest extends AbstractCommonAttributesTest {
+ private Label tag;
+
+ public void testRenderLabel() {
+ tag.setName("name");
+ tag.setValue("val1");
+ tag.setId("id1");
+ tag.setFor("for_");
+ tag.setCssClass("class1");
+ tag.setCssStyle("style1");
+ tag.setTitle("title");
+
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<label name='name' for='for_' id='id1'
class='class1' style='style1' title='title'>val1</label>");
+ assertEquals(expected, output);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.tag = new Label(stack, request, response);
+ }
+
+ @Override
+ protected UIBean getUIBean() {
+ return tag;
+ }
+
+ @Override
+ protected String getTagName() {
+ return "label";
+ }
+}
+
+
+
Propchange:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/LabelTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/LabelTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/PasswordTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/PasswordTest.java?rev=1081295&r1=1081294&r2=1081295&view=diff
==============================================================================
---
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/PasswordTest.java
(original)
+++
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/PasswordTest.java
Mon Mar 14 09:54:09 2011
@@ -1,103 +1,101 @@
-/*
- * $Id$
- *
- * 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.struts2.views.java.simple;
-
-import org.apache.struts2.components.File;
-import org.apache.struts2.components.UIBean;
-import org.apache.struts2.components.Password;
-import org.easymock.EasyMock;
-
-public class PasswordTest extends AbstractCommonAttributesTest {
- private Password tag;
- private boolean showPassword;
-
- public void testRenderPassword() throws Exception {
- this.showPassword = false;
- super.setUp();
- this.tag = new Password(stack, request, response);
-
- tag.setName("name");
- tag.setValue("val1");
- tag.setSize("10");
- tag.setDisabled("true");
- tag.setTabindex("1");
- tag.setId("id1");
- tag.setCssClass("class1");
- tag.setCssStyle("style1");
- tag.setTitle("title");
-
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- String output = writer.getBuffer().toString();
- String expected = s("<input name='name' type='password' size='10'
tabindex='1' id='id1' class='class1' style='style1' title='title'></input>");
- assertEquals(expected, output);
- }
-
- public void testRenderPasswordShowIt() throws Exception {
- this.showPassword = true;
- super.setUp();
- this.tag = new Password(stack, request, response);
-
- tag.setName("name");
- tag.setValue("val1");
- tag.setSize("10");
- tag.setDisabled("true");
- tag.setTabindex("1");
- tag.setId("id1");
- tag.setCssClass("class1");
- tag.setCssStyle("style1");
- tag.setTitle("title");
- tag.setShowPassword("%{'true'}");
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- String output = writer.getBuffer().toString();
- String expected = s("<input value='val1' name='name' type='password'
size='10' tabindex='1' id='id1' class='class1' style='style1'
title='title'></input>");
- assertEquals(expected, output);
- }
-
- @Override
- protected void setUp() throws Exception {
- //dont call base setup
- }
-
- @Override
- protected void setUpStack() {
- expectFind("'true'", Boolean.class, true);
- }
-
- @Override
- protected UIBean getUIBean() throws Exception {
- super.setUp();
- this.tag = new Password(stack, request, response);
- return tag;
- }
-
- @Override
- protected String getTagName() {
- return "password";
- }
-}
-
-
+/*
+ * $Id$
+ *
+ * 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.struts2.views.java.simple;
+
+import org.apache.struts2.components.Password;
+import org.apache.struts2.components.UIBean;
+
+public class PasswordTest extends AbstractCommonAttributesTest {
+ private Password tag;
+ private boolean showPassword;
+
+ public void testRenderPassword() throws Exception {
+ this.showPassword = false;
+ super.setUp();
+ this.tag = new Password(stack, request, response);
+
+ tag.setName("name");
+ tag.setValue("val1");
+ tag.setSize("10");
+ tag.setDisabled("true");
+ tag.setTabindex("1");
+ tag.setId("id1");
+ tag.setCssClass("class1");
+ tag.setCssStyle("style1");
+ tag.setTitle("title");
+
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<input name='name' type='password' size='10'
tabindex='1' id='id1' class='class1' style='style1' title='title'></input>");
+ assertEquals(expected, output);
+ }
+
+ public void testRenderPasswordShowIt() throws Exception {
+ this.showPassword = true;
+ super.setUp();
+ this.tag = new Password(stack, request, response);
+
+ tag.setName("name");
+ tag.setValue("val1");
+ tag.setSize("10");
+ tag.setDisabled("true");
+ tag.setTabindex("1");
+ tag.setId("id1");
+ tag.setCssClass("class1");
+ tag.setCssStyle("style1");
+ tag.setTitle("title");
+ tag.setShowPassword("%{'true'}");
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<input value='val1' name='name' type='password'
size='10' tabindex='1' id='id1' class='class1' style='style1'
title='title'></input>");
+ assertEquals(expected, output);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ //dont call base setup
+ }
+
+ @Override
+ protected void setUpStack() {
+ expectFind("'true'", Boolean.class, true);
+ }
+
+ @Override
+ protected UIBean getUIBean() throws Exception {
+ super.setUp();
+ this.tag = new Password(stack, request, response);
+ return tag;
+ }
+
+ @Override
+ protected String getTagName() {
+ return "password";
+ }
+}
+
+
Propchange:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/PasswordTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/PasswordTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/ResetTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/ResetTest.java?rev=1081295&r1=1081294&r2=1081295&view=diff
==============================================================================
---
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/ResetTest.java
(original)
+++
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/ResetTest.java
Mon Mar 14 09:54:09 2011
@@ -1,86 +1,85 @@
-/*
- * $Id$
- *
- * 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.struts2.views.java.simple;
-
-import org.apache.struts2.components.File;
-import org.apache.struts2.components.UIBean;
-import org.apache.struts2.components.Reset;
-
-public class ResetTest extends AbstractCommonAttributesTest {
- private Reset tag;
-
- public void testRenderResetButton() {
- tag.setName("name");
- tag.setValue("val1");
- tag.setTabindex("1");
- tag.setId("id1");
- tag.setCssClass("class1");
- tag.setCssStyle("style1");
- tag.setTitle("title");
- tag.setType("button");
- tag.setLabel("some label");
-
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- String output = writer.getBuffer().toString();
- String expected = s("<input name='name' type='reset' value='val1'
tabindex='1' id='id1' class='class1' style='style1'>some label</input>");
- assertEquals(expected, output);
- }
-
- public void testRenderResetNoType() {
- tag.setName("name");
- tag.setValue("val1");
- tag.setTabindex("1");
- tag.setId("id1");
- tag.setCssClass("class1");
- tag.setCssStyle("style1");
- tag.setTitle("title");
- tag.setLabel("some label");
-
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- String output = writer.getBuffer().toString();
- String expected = s("<input name='name' type='reset' value='val1'
tabindex='1' id='id1' class='class1' style='style1' title='title'></input>");
- assertEquals(expected, output);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.tag = new Reset(stack, request, response);
- }
-
- @Override
- protected UIBean getUIBean() {
- return tag;
- }
-
- @Override
- protected String getTagName() {
- return "reset";
- }
-}
-
-
+/*
+ * $Id$
+ *
+ * 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.struts2.views.java.simple;
+
+import org.apache.struts2.components.Reset;
+import org.apache.struts2.components.UIBean;
+
+public class ResetTest extends AbstractCommonAttributesTest {
+ private Reset tag;
+
+ public void testRenderResetButton() {
+ tag.setName("name");
+ tag.setValue("val1");
+ tag.setTabindex("1");
+ tag.setId("id1");
+ tag.setCssClass("class1");
+ tag.setCssStyle("style1");
+ tag.setTitle("title");
+ tag.setType("button");
+ tag.setLabel("some label");
+
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<input name='name' type='reset' value='val1'
tabindex='1' id='id1' class='class1' style='style1'>some label</input>");
+ assertEquals(expected, output);
+ }
+
+ public void testRenderResetNoType() {
+ tag.setName("name");
+ tag.setValue("val1");
+ tag.setTabindex("1");
+ tag.setId("id1");
+ tag.setCssClass("class1");
+ tag.setCssStyle("style1");
+ tag.setTitle("title");
+ tag.setLabel("some label");
+
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<input name='name' type='reset' value='val1'
tabindex='1' id='id1' class='class1' style='style1' title='title'></input>");
+ assertEquals(expected, output);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.tag = new Reset(stack, request, response);
+ }
+
+ @Override
+ protected UIBean getUIBean() {
+ return tag;
+ }
+
+ @Override
+ protected String getTagName() {
+ return "reset";
+ }
+}
+
+
Propchange:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/ResetTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/ResetTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/SubmitTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/SubmitTest.java?rev=1081295&r1=1081294&r2=1081295&view=diff
==============================================================================
---
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/SubmitTest.java
(original)
+++
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/SubmitTest.java
Mon Mar 14 09:54:09 2011
@@ -1,169 +1,168 @@
-/*
- * $Id$
- *
- * 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.struts2.views.java.simple;
-
-import org.apache.struts2.components.File;
-import org.apache.struts2.components.UIBean;
-import org.apache.struts2.components.Submit;
-
-public class SubmitTest extends AbstractCommonAttributesTest {
- private Submit tag;
-
- public void testRenderButtonWithBody() {
- tag.setName("name");
- tag.setValue("val1");
- tag.setDisabled("true");
- tag.setTabindex("1");
- tag.setId("id1");
- tag.setCssClass("class1");
- tag.setCssStyle("style1");
- tag.setTitle("title");
- tag.setLabel("some label");
- tag.setType("button");
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
-
- tag.addParameter("body", "<span>hey hey hey, here I go now</span>");
- map.clear();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName() + "-close", context);
- String output = writer.getBuffer().toString();
- String expected = s("<button name='name' type='submit' value='val1'
tabindex='1' id='id1' class='class1' style='style1'><span>hey hey hey, here I
go now</span></button>");
- assertEquals(expected, output);
- }
-
- public void testRenderButtonWithLabel() {
- tag.setName("name");
- tag.setValue("val1");
- tag.setDisabled("true");
- tag.setTabindex("1");
- tag.setId("id1");
- tag.setCssClass("class1");
- tag.setCssStyle("style1");
- tag.setTitle("title");
- tag.setLabel("Just as soon as I belong, than its time I disappear");
- tag.setType("button");
-
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- theme.renderTag(getTagName() + "-close", context);
- String output = writer.getBuffer().toString();
- String expected = s("<button name='name' type='submit' value='val1'
tabindex='1' id='id1' class='class1' style='style1'>Just as soon as I belong,
than its time I disappear</button>");
- assertEquals(expected, output);
- }
-
- public void testRenderButtonSubmit() {
- tag.setName("name");
- tag.setValue("val1");
- tag.setDisabled("true");
- tag.setTabindex("1");
- tag.setId("id1");
- tag.setCssClass("class1");
- tag.setCssStyle("style1");
- tag.setTitle("title");
- tag.setLabel("label");
- tag.setType("input");
-
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- theme.renderTag(getTagName() + "-close", context);
- String output = writer.getBuffer().toString();
- String expected = s("<input name='name' type='submit' value='val1'
tabindex='1' id='id1' class='class1' style='style1'></input>");
- assertEquals(expected, output);
- }
-
- public void testRenderButtonWithoutType() {
- tag.setName("name");
- tag.setValue("val1");
- tag.setDisabled("true");
- tag.setTabindex("1");
- tag.setId("id1");
- tag.setCssClass("class1");
- tag.setCssStyle("style1");
- tag.setTitle("title");
- tag.setLabel("label");
-
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- theme.renderTag(getTagName() + "-close", context);
- String output = writer.getBuffer().toString();
- String expected = s("<input name='name' type='submit' value='val1'
tabindex='1' id='id1' class='class1' style='style1'></input>");
- assertEquals(expected, output);
- }
-
- public void testRenderButtonImage() {
- tag.setSrc("http://somesource/image.gif");
- tag.setLabel("alt text");
- tag.setType("image");
-
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- theme.renderTag(getTagName() + "-close", context);
- String output = writer.getBuffer().toString();
- String expected = s("<input src='http://somesource/image.gif'
type='image' alt='alt text'></input>");
- assertEquals(expected, output);
- }
-
- public void testRenderButtonImageWithBody() {
- tag.setSrc("http://somesource/image.gif");
- tag.setLabel("alt text");
- tag.setType("image");
-
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- map.clear();
- tag.setType("image");
- tag.addParameter("body", "<span>hey hey hey, here I go now</span>");
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName() + "-close", context);
- String output = writer.getBuffer().toString();
- String expected = s("<input src='http://somesource/image.gif'
type='image' alt='alt text'><span>hey hey hey, here I go now</span></input>");
- assertEquals(expected, output);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.tag = new Submit(stack, request, response);
- }
-
- @Override
- protected UIBean getUIBean() {
- return tag;
- }
-
- @Override
- protected String getTagName() {
- return "submit";
- }
-}
+/*
+ * $Id$
+ *
+ * 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.struts2.views.java.simple;
+
+import org.apache.struts2.components.Submit;
+import org.apache.struts2.components.UIBean;
+
+public class SubmitTest extends AbstractCommonAttributesTest {
+ private Submit tag;
+
+ public void testRenderButtonWithBody() {
+ tag.setName("name");
+ tag.setValue("val1");
+ tag.setDisabled("true");
+ tag.setTabindex("1");
+ tag.setId("id1");
+ tag.setCssClass("class1");
+ tag.setCssStyle("style1");
+ tag.setTitle("title");
+ tag.setLabel("some label");
+ tag.setType("button");
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+
+ tag.addParameter("body", "<span>hey hey hey, here I go now</span>");
+ map.clear();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName() + "-close", context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<button name='name' type='submit' value='val1'
tabindex='1' id='id1' class='class1' style='style1'><span>hey hey hey, here I
go now</span></button>");
+ assertEquals(expected, output);
+ }
+
+ public void testRenderButtonWithLabel() {
+ tag.setName("name");
+ tag.setValue("val1");
+ tag.setDisabled("true");
+ tag.setTabindex("1");
+ tag.setId("id1");
+ tag.setCssClass("class1");
+ tag.setCssStyle("style1");
+ tag.setTitle("title");
+ tag.setLabel("Just as soon as I belong, than its time I disappear");
+ tag.setType("button");
+
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ theme.renderTag(getTagName() + "-close", context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<button name='name' type='submit' value='val1'
tabindex='1' id='id1' class='class1' style='style1'>Just as soon as I belong,
than its time I disappear</button>");
+ assertEquals(expected, output);
+ }
+
+ public void testRenderButtonSubmit() {
+ tag.setName("name");
+ tag.setValue("val1");
+ tag.setDisabled("true");
+ tag.setTabindex("1");
+ tag.setId("id1");
+ tag.setCssClass("class1");
+ tag.setCssStyle("style1");
+ tag.setTitle("title");
+ tag.setLabel("label");
+ tag.setType("input");
+
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ theme.renderTag(getTagName() + "-close", context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<input name='name' type='submit' value='val1'
tabindex='1' id='id1' class='class1' style='style1'></input>");
+ assertEquals(expected, output);
+ }
+
+ public void testRenderButtonWithoutType() {
+ tag.setName("name");
+ tag.setValue("val1");
+ tag.setDisabled("true");
+ tag.setTabindex("1");
+ tag.setId("id1");
+ tag.setCssClass("class1");
+ tag.setCssStyle("style1");
+ tag.setTitle("title");
+ tag.setLabel("label");
+
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ theme.renderTag(getTagName() + "-close", context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<input name='name' type='submit' value='val1'
tabindex='1' id='id1' class='class1' style='style1'></input>");
+ assertEquals(expected, output);
+ }
+
+ public void testRenderButtonImage() {
+ tag.setSrc("http://somesource/image.gif");
+ tag.setLabel("alt text");
+ tag.setType("image");
+
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ theme.renderTag(getTagName() + "-close", context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<input src='http://somesource/image.gif'
type='image' alt='alt text'></input>");
+ assertEquals(expected, output);
+ }
+
+ public void testRenderButtonImageWithBody() {
+ tag.setSrc("http://somesource/image.gif");
+ tag.setLabel("alt text");
+ tag.setType("image");
+
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ map.clear();
+ tag.setType("image");
+ tag.addParameter("body", "<span>hey hey hey, here I go now</span>");
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName() + "-close", context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<input src='http://somesource/image.gif'
type='image' alt='alt text'><span>hey hey hey, here I go now</span></input>");
+ assertEquals(expected, output);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.tag = new Submit(stack, request, response);
+ }
+
+ @Override
+ protected UIBean getUIBean() {
+ return tag;
+ }
+
+ @Override
+ protected String getTagName() {
+ return "submit";
+ }
+}
Propchange:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/SubmitTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/SubmitTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TextAreaTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TextAreaTest.java?rev=1081295&r1=1081294&r2=1081295&view=diff
==============================================================================
---
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TextAreaTest.java
(original)
+++
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TextAreaTest.java
Mon Mar 14 09:54:09 2011
@@ -1,86 +1,85 @@
-/*
- * $Id$
- *
- * 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.struts2.views.java.simple;
-
-import org.apache.struts2.components.TextField;
-import org.apache.struts2.components.UIBean;
-import org.apache.struts2.components.TextArea;
-
-public class TextAreaTest extends AbstractCommonAttributesTest {
- private TextArea tag;
-
- public void testRenderTextArea() {
- tag.setName("name");
- tag.setValue("val1");
- tag.setDisabled("true");
- tag.setReadonly("true");
- tag.setTabindex("1");
- tag.setId("id1");
- tag.setCssClass("class1");
- tag.setCssStyle("style1");
- tag.setTitle("title");
- tag.setRows("1");
- tag.setCols("2");
-
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- String output = writer.getBuffer().toString();
- String expected = s("<textarea name='name' cols='2' rows='1'
tabindex='1' id='id1' class='class1' style='style1'
title='title'>val1</textarea>");
- assertEquals(expected, output);
- }
-
- public void testRenderTextAreaDefaults() {
- tag.setValue("val1");
- tag.setDisabled("true");
- tag.setReadonly("true");
- tag.setTabindex("1");
- tag.setId("id1");
- tag.setCssClass("class1");
- tag.setCssStyle("style1");
- tag.setTitle("title");
-
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- String output = writer.getBuffer().toString();
- String expected = s("<textarea name='' cols='' rows='' tabindex='1'
id='id1' class='class1' style='style1' title='title'>val1</textarea>");
- assertEquals(expected, output);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.tag = new TextArea(stack, request, response);
- }
-
- @Override
- protected UIBean getUIBean() {
- return tag;
- }
-
- @Override
- protected String getTagName() {
- return "textarea";
- }
-}
+/*
+ * $Id$
+ *
+ * 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.struts2.views.java.simple;
+
+import org.apache.struts2.components.TextArea;
+import org.apache.struts2.components.UIBean;
+
+public class TextAreaTest extends AbstractCommonAttributesTest {
+ private TextArea tag;
+
+ public void testRenderTextArea() {
+ tag.setName("name");
+ tag.setValue("val1");
+ tag.setDisabled("true");
+ tag.setReadonly("true");
+ tag.setTabindex("1");
+ tag.setId("id1");
+ tag.setCssClass("class1");
+ tag.setCssStyle("style1");
+ tag.setTitle("title");
+ tag.setRows("1");
+ tag.setCols("2");
+
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<textarea name='name' cols='2' rows='1'
tabindex='1' id='id1' class='class1' style='style1'
title='title'>val1</textarea>");
+ assertEquals(expected, output);
+ }
+
+ public void testRenderTextAreaDefaults() {
+ tag.setValue("val1");
+ tag.setDisabled("true");
+ tag.setReadonly("true");
+ tag.setTabindex("1");
+ tag.setId("id1");
+ tag.setCssClass("class1");
+ tag.setCssStyle("style1");
+ tag.setTitle("title");
+
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ String output = writer.getBuffer().toString();
+ String expected = s("<textarea name='' cols='' rows='' tabindex='1'
id='id1' class='class1' style='style1' title='title'>val1</textarea>");
+ assertEquals(expected, output);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.tag = new TextArea(stack, request, response);
+ }
+
+ @Override
+ protected UIBean getUIBean() {
+ return tag;
+ }
+
+ @Override
+ protected String getTagName() {
+ return "textarea";
+ }
+}
Propchange:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TextAreaTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TextAreaTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TokenTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TokenTest.java?rev=1081295&r1=1081294&r2=1081295&view=diff
==============================================================================
---
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TokenTest.java
(original)
+++
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TokenTest.java
Mon Mar 14 09:54:09 2011
@@ -1,69 +1,68 @@
-/*
- * $Id$
- *
- * 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.struts2.views.java.simple;
-
-import org.apache.struts2.components.TextField;
-import org.apache.struts2.components.UIBean;
-import org.apache.struts2.components.Token;
-import com.opensymphony.xwork2.ActionContext;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Pattern;
-
-public class TokenTest extends AbstractTest {
- private Token tag;
-
- public void testRenderTokenTag() {
- tag.setName("name");
- tag.setValue("val1");
-
- tag.evaluateParams();
- map.putAll(tag.getParameters());
- theme.renderTag(getTagName(), context);
- String output = writer.getBuffer().toString();
-
-
- //token id is random
- String pattern = s("<input type='hidden' name='struts.token.name'
value='name'></input><input type='hidden' name='name' value='.*?'></input>");
- assertTrue(Pattern.matches(pattern, output));
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.tag = new Token(stack, request, response);
-
- Map map = new HashMap();
- map.put(ActionContext.SESSION, new HashMap());
- ActionContext.setContext(new ActionContext(map));
- }
-
- @Override
- protected UIBean getUIBean() {
- return tag;
- }
-
- @Override
- protected String getTagName() {
- return "token";
- }
-}
+/*
+ * $Id$
+ *
+ * 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.struts2.views.java.simple;
+
+import com.opensymphony.xwork2.ActionContext;
+import org.apache.struts2.components.Token;
+import org.apache.struts2.components.UIBean;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+public class TokenTest extends AbstractTest {
+ private Token tag;
+
+ public void testRenderTokenTag() {
+ tag.setName("name");
+ tag.setValue("val1");
+
+ tag.evaluateParams();
+ map.putAll(tag.getParameters());
+ theme.renderTag(getTagName(), context);
+ String output = writer.getBuffer().toString();
+
+
+ //token id is random
+ String pattern = s("<input type='hidden' name='struts.token.name'
value='name'></input><input type='hidden' name='name' value='.*?'></input>");
+ assertTrue(Pattern.matches(pattern, output));
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.tag = new Token(stack, request, response);
+
+ Map map = new HashMap();
+ map.put(ActionContext.SESSION, new HashMap());
+ ActionContext.setContext(new ActionContext(map));
+ }
+
+ @Override
+ protected UIBean getUIBean() {
+ return tag;
+ }
+
+ @Override
+ protected String getTagName() {
+ return "token";
+ }
+}
Propchange:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TokenTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/plugins/javatemplates/src/test/java/org/apache/struts2/views/java/simple/TokenTest.java
------------------------------------------------------------------------------
svn:keywords = Id