You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ba...@apache.org on 2007/01/09 19:59:43 UTC

svn commit: r494523 - in /myfaces/core/branches/jsf12: build/src/main/resources/META-INF/maven-faces-plugin/components/includes/html/ impl/src/test/java/org/apache/myfaces/renderkit/html/

Author: baranda
Date: Tue Jan  9 10:59:42 2007
New Revision: 494523

URL: http://svn.apache.org/viewvc?view=rev&rev=494523
Log:
JSR-252: Fixed default values for UIInput. Added simple test  for the text renderer

Added:
    myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmTextRendererTest.java
Modified:
    myfaces/core/branches/jsf12/build/src/main/resources/META-INF/maven-faces-plugin/components/includes/html/SizeProperty.xml
    myfaces/core/branches/jsf12/build/src/main/resources/META-INF/maven-faces-plugin/components/includes/html/_InputTextFieldsProperties.xml

Modified: myfaces/core/branches/jsf12/build/src/main/resources/META-INF/maven-faces-plugin/components/includes/html/SizeProperty.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/build/src/main/resources/META-INF/maven-faces-plugin/components/includes/html/SizeProperty.xml?view=diff&rev=494523&r1=494522&r2=494523
==============================================================================
--- myfaces/core/branches/jsf12/build/src/main/resources/META-INF/maven-faces-plugin/components/includes/html/SizeProperty.xml (original)
+++ myfaces/core/branches/jsf12/build/src/main/resources/META-INF/maven-faces-plugin/components/includes/html/SizeProperty.xml Tue Jan  9 10:59:42 2007
@@ -19,12 +19,13 @@
 		xmlns:xi="http://www.w3.org/2001/XInclude">
 	<component>
         <property>
-			<description>The initial width of this control, in characters.</description>
-			<property-name>size</property-name>
+            <description>The initial width of this control, in characters.</description>
+            <property-name>size</property-name>
             <property-class>int</property-class>
-			<property-extension>
-				<mfp:required>false</mfp:required>
-			</property-extension>
-		</property>
+            <default-value>-2147483648</default-value>
+            <property-extension>
+                <mfp:required>false</mfp:required>
+            </property-extension>
+        </property>
     </component>
 </faces-config>

Modified: myfaces/core/branches/jsf12/build/src/main/resources/META-INF/maven-faces-plugin/components/includes/html/_InputTextFieldsProperties.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/build/src/main/resources/META-INF/maven-faces-plugin/components/includes/html/_InputTextFieldsProperties.xml?view=diff&rev=494523&r1=494522&r2=494523
==============================================================================
--- myfaces/core/branches/jsf12/build/src/main/resources/META-INF/maven-faces-plugin/components/includes/html/_InputTextFieldsProperties.xml (original)
+++ myfaces/core/branches/jsf12/build/src/main/resources/META-INF/maven-faces-plugin/components/includes/html/_InputTextFieldsProperties.xml Tue Jan  9 10:59:42 2007
@@ -32,25 +32,27 @@
         <xi:include href="SizeProperty.xml" xpointer="/faces_config/component/*" />
 
         <property>
-			<description>The maximum number of characters allowed to be entered.</description>
-			<property-name>maxlength</property-name>
+            <description>The maximum number of characters allowed to be entered.</description>
+            <property-name>maxlength</property-name>
             <property-class>int</property-class>
-			<property-extension>
-				<mfp:required>false</mfp:required>
-			</property-extension>
-		</property>
+            <default-value>-2147483648</default-value>
+            <property-extension>
+                <mfp:required>false</mfp:required>
+            </property-extension>
+        </property>
 
         <property>
-			<description>If the value of this attribute is "off", render "off" as the value of the attribute.
-This indicates that the browser should disable its autocomplete feature for this component.
-This is useful for components that perform autocompletion and do not want the browser interfering.
-If this attribute is not set or the value is "on", render nothing.</description>
-			<property-name>autocomplete</property-name>
+            <description>If the value of this attribute is "off", render "off" as the value of the attribute.
+                This indicates that the browser should disable its autocomplete feature for this component.
+                This is useful for components that perform autocompletion and do not want the browser interfering.
+                If this attribute is not set or the value is "on", render nothing.
+            </description>
+            <property-name>autocomplete</property-name>
             <property-class>java.lang.String</property-class>
-			<property-extension>
-				<mfp:required>false</mfp:required>
-			</property-extension>
-		</property>
+            <property-extension>
+                <mfp:required>false</mfp:required>
+            </property-extension>
+        </property>
 
     </component>
 </faces-config>

Added: myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmTextRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmTextRendererTest.java?view=auto&rev=494523
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmTextRendererTest.java (added)
+++ myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmTextRendererTest.java Tue Jan  9 10:59:42 2007
@@ -0,0 +1,62 @@
+package org.apache.myfaces.renderkit.html;
+
+import org.apache.shale.test.base.AbstractJsfTestCase;
+import org.apache.shale.test.mock.MockResponseWriter;
+import org.apache.shale.test.mock.MockRenderKitFactory;
+
+import javax.faces.component.html.HtmlSelectOneRadio;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.UISelectItems;
+import javax.faces.model.SelectItem;
+import java.io.StringWriter;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Bruno Aranda (latest modification by $Author: baranda $)
+ * @version $Revision: 451814 $ $Date: 2006-10-01 22:28:42 +0100 (dom, 01 oct 2006) $
+ */
+public class HtmTextRendererTest extends AbstractJsfTestCase
+{
+    private MockResponseWriter writer ;
+    private HtmlInputText inputText;
+
+    public HtmTextRendererTest(String name)
+    {
+        super(name);
+    }
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+
+        inputText = new HtmlInputText();
+
+        writer = new MockResponseWriter(new StringWriter(), null, null);
+        facesContext.setResponseWriter(writer);
+
+        facesContext.getViewRoot().setRenderKitId(MockRenderKitFactory.HTML_BASIC_RENDER_KIT);
+        facesContext.getRenderKit().addRenderer(
+                inputText.getFamily(),
+                inputText.getRendererType(),
+                new HtmlTextRenderer());
+
+    }
+
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+        inputText = null;
+        writer = null;
+    }
+
+    public void testInputTextDefault() throws Exception
+    {
+        inputText.encodeEnd(facesContext);
+        facesContext.renderResponse();
+
+        String output = writer.getWriter().toString();
+
+        assertEquals("<input id=\"_id0\" name=\"_id0\" type=\"text\" value=\"\"/>", output);
+    }
+}