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 2006/06/12 23:50:04 UTC

svn commit: r413749 - in /myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit: ./ html/ html/HtmlTextRendererTest.java

Author: baranda
Date: Mon Jun 12 14:50:03 2006
New Revision: 413749

URL: http://svn.apache.org/viewvc?rev=413749&view=rev
Log:
Don't ask why I have created this test. I was observing strange behaviour in an app of mine... well, nice to have tests anyway!

Added:
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextRendererTest.java   (with props)

Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextRendererTest.java?rev=413749&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextRendererTest.java Mon Jun 12 14:50:03 2006
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.myfaces.renderkit.html;
+
+import junit.framework.Test;
+import org.apache.shale.test.base.AbstractJsfTestCase;
+import org.apache.shale.test.mock.MockRenderKitFactory;
+import org.apache.shale.test.mock.MockResponseWriter;
+
+import javax.faces.component.html.HtmlOutputText;
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * @author Bruno Aranda (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlTextRendererTest extends AbstractJsfTestCase
+{
+
+     public static Test suite()
+    {
+        return null; // needed in maven
+    }
+
+    private MockResponseWriter writer ;
+    private HtmlOutputText outputText;
+
+    public HtmlTextRendererTest(String name)
+    {
+        super(name);
+    }
+
+    public void setUp()
+    {
+        super.setUp();
+
+        outputText = new HtmlOutputText();
+
+        writer = new MockResponseWriter(new StringWriter(), null, null);
+        facesContext.setResponseWriter(writer);
+        // TODO remove these two lines once shale-test goes alpha, see MYFACES-1155
+        facesContext.getViewRoot().setRenderKitId(MockRenderKitFactory.HTML_BASIC_RENDER_KIT);
+        facesContext.getRenderKit().addRenderer(
+                outputText.getFamily(),
+                outputText.getRendererType(),
+                new HtmlTextRenderer());
+    }
+
+    public void tearDown()
+    {
+        super.tearDown();
+        outputText = null;
+        writer = null;
+    }
+
+    public void testStyleClassAttr() throws IOException
+    {
+        outputText.setValue("Output");
+        outputText.setStyleClass("myStyleClass");
+
+        outputText.encodeEnd(facesContext);
+        facesContext.renderResponse();
+
+        String output = writer.getWriter().toString();
+
+        assertEquals("<span class=\"myStyleClass\">Output</span>", output);
+        assertNotSame("Output", output);
+    }
+
+}

Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextRendererTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/HtmlTextRendererTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL