You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2009/11/27 00:38:04 UTC

svn commit: r884724 - in /myfaces/core/trunk/impl/src/test: java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputLabelTestCase.java resources/org/apache/myfaces/view/facelets/tag/jsf/html/testOutputLabelEscape.xhtml

Author: lu4242
Date: Thu Nov 26 23:38:04 2009
New Revision: 884724

URL: http://svn.apache.org/viewvc?rev=884724&view=rev
Log:
add test for escape and h:outputLabel

Added:
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputLabelTestCase.java
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testOutputLabelEscape.xhtml

Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputLabelTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputLabelTestCase.java?rev=884724&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputLabelTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputLabelTestCase.java Thu Nov 26 23:38:04 2009
@@ -0,0 +1,71 @@
+/*
+ * 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.myfaces.view.facelets.tag.jsf.html;
+
+import java.io.StringWriter;
+
+import javax.el.MethodExpression;
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.component.UINamingContainer;
+import javax.faces.component.UIOutput;
+import javax.faces.component.UISelectItem;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlOutputText;
+
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+import org.apache.myfaces.test.utils.HtmlRenderedAttr;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.bean.HelloWorld;
+import org.apache.myfaces.test.mock.MockResponseWriter;
+
+public class HtmlOutputLabelTestCase extends FaceletTestCase
+{
+
+    public void testOutputLabelEscape() throws Exception
+    {
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "testOutputLabelEscape.xhtml");
+
+        UIComponent panelGroup = root.findComponent("testGroup1");
+        assertNotNull(panelGroup);
+        UIOutput label = (UIOutput) panelGroup.findComponent("testLabel");
+        assertNotNull(label);
+        UIOutput text = (UIOutput) panelGroup.findComponent("testOut");
+        assertNotNull(text);
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        
+        panelGroup.encodeAll(facesContext);
+        sw.flush();
+
+        /*
+        HtmlRenderedAttr[] attrs = new HtmlRenderedAttr[]{
+                new HtmlRenderedAttr("value")
+        };
+            
+        HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
+        */
+    }
+    
+}

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testOutputLabelEscape.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testOutputLabelEscape.xhtml?rev=884724&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testOutputLabelEscape.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/jsf/html/testOutputLabelEscape.xhtml Thu Nov 26 23:38:04 2009
@@ -0,0 +1,28 @@
+<!--
+ 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.
+
+ $Id: defineInclude.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core">
+<head>
+</head>
+<body>
+<h:panelGroup id="testGroup1">
+<h:outputText id="testOut"/>
+<h:outputLabel id="testLabel" for="testOut" value="&amp;foo"/>
+</h:panelGroup>
+</body>
+</html>
\ No newline at end of file