Index: java/org/apache/myfaces/view/facelets/el/HtmlRolePassedThroughTestCase.java =================================================================== --- java/org/apache/myfaces/view/facelets/el/HtmlRolePassedThroughTestCase.java (revision 0) +++ java/org/apache/myfaces/view/facelets/el/HtmlRolePassedThroughTestCase.java (working copy) @@ -0,0 +1,82 @@ +package org.apache.myfaces.view.facelets.el; + +import static org.junit.Assert.*; + +import java.io.StringWriter; + +import javax.el.ExpressionFactory; +import javax.faces.application.ViewHandler; +import javax.faces.component.UIViewRoot; + +import junit.framework.Assert; + +import org.apache.myfaces.test.mock.MockResponseWriter; +import org.apache.myfaces.view.facelets.ELExpressionCacheMode; +import org.apache.myfaces.view.facelets.FaceletTestCase; +import org.apache.myfaces.view.facelets.impl.FaceletCompositionContextImpl; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class HtmlRolePassedThroughTestCase extends FaceletTestCase { + + + + @Override + protected void setUpServletObjects() throws Exception + { + super.setUpServletObjects(); + servletContext.addInitParameter(FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS, + ELExpressionCacheMode.alwaysRecompile.toString()); + servletContext.addInitParameter(ViewHandler.FACELETS_SKIP_COMMENTS_PARAM_NAME, "true"); + servletContext.addInitParameter(ViewHandler.FACELETS_LIBRARIES_PARAM_NAME, "/user.taglib.xml"); + } + + @Override + protected ExpressionFactory createExpressionFactory() + { + return new org.apache.el.ExpressionFactoryImpl(); + } + + @Test + public void testRole() throws Exception + { + UIViewRoot root = facesContext.getViewRoot(); + vdl.buildView(facesContext, root, "role.xhtml"); + + StringWriter sw = new StringWriter(); + MockResponseWriter mrw = new MockResponseWriter(sw); + facesContext.setResponseWriter(mrw); + + root.encodeAll(facesContext); + sw.flush(); + System.out.println("********************HTMLRolePassedThroughTest*****************"); + System.out.println(sw.toString()); + System.out.println("********************HTMLRolePassedThroughTest*****************"); + Assert.assertTrue(sw.toString().contains("value=\"user name\" role=\"new presentation\"")); + Assert.assertTrue(sw.toString().contains("id=\"helloForm:link\" role=\"new presentation\"")); + Assert.assertTrue(sw.toString().contains("")); + Assert.assertTrue(sw.toString().contains("value=\"one\" role=\"new presentation\"")); + + Assert.assertTrue(sw.toString().contains("id=\"helloForm:data\" role=\"new presentation\"")); + Assert.assertTrue(sw.toString().contains("id=\"helloForm:graphic\" role=\"new presentation\"")); + Assert.assertTrue(sw.toString().contains("type=\"file\" role=\"new presentation\"")); + Assert.assertTrue(sw.toString().contains("name=\"helloForm:area\" role=\"new presentation\"")); + + Assert.assertTrue(sw.toString().contains("id=\"helloForm:outputFormat\" role=\"new presentation\"")); + Assert.assertTrue(sw.toString().contains("id=\"helloForm:outputLabel\" role=\"new presentation\"")); + Assert.assertTrue(sw.toString().contains("name=\"helloForm:outputLink\" role=\"new presentation\"")); + Assert.assertTrue(sw.toString().contains("id=\"helloForm:outputText\" role=\"new presentation\"")); + + // Assert.assertTrue(sw.toString().contains("(?s).* + + + + +This text above will not be displayed. + + + +This text will not be displayed. + + + I'm thinking of a number from #{NumberBean.min} to #{NumberBean.max}. Can you guess it? + + +This text will also not be displayed. + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ +This text will not be displayed. + +
+ +This text below will also not be displayed. + + + \ No newline at end of file Index: resources/org/apache/myfaces/view/facelets/el/template.xhtml =================================================================== --- resources/org/apache/myfaces/view/facelets/el/template.xhtml (revision 0) +++ resources/org/apache/myfaces/view/facelets/el/template.xhtml (working copy) @@ -0,0 +1,43 @@ + + + + + +Facelets: Number Guess Tutorial + + + + +

+ Default Title +

+

+ Default Body +

+ + + \ No newline at end of file