ResponseWriter mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
facesContext.setResponseWriter(mrw);
HtmlRenderedAttr[] attrs = {
new HtmlRenderedAttr("data_up", "Going Up"),
new HtmlRenderedAttr("placeholder", "Enter text"),
new HtmlRenderedAttr("onclick", "alert('hello')"),
//new HtmlRenderedAttr("customAttr", "SomeValue"),
new HtmlRenderedAttr("value", "value1")
};
input1.encodeAll(facesContext);
sw.flush();
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
Assert.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
sw = new StringWriter();
mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
facesContext.setResponseWriter(mrw);
input2.encodeAll(facesContext);
sw.flush();
attrs = new HtmlRenderedAttr[]{
new HtmlRenderedAttr("data_up", "Going Up"),
new HtmlRenderedAttr("onclick", "alert('hello')"),
//new HtmlRenderedAttr("customAttr", "SomeValue"),
new HtmlRenderedAttr("placeholder", "Enter text")
};
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
Assert.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
Assert.assertTrue(sw.toString().contains("<meter "));
Assert.assertTrue(sw.toString().contains("</meter>"));
sw = new StringWriter();
mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
facesContext.setResponseWriter(mrw);
input3.encodeAll(facesContext);
sw.flush();
attrs = new HtmlRenderedAttr[]{
new HtmlRenderedAttr("data_up", "Going Up"),
//new HtmlRenderedAttr("placeholder", "Enter text"),
//new HtmlRenderedAttr("customAttr", "SomeValue"),
//new HtmlRenderedAttr("value", "value1"),
new HtmlRenderedAttr("onclick", "alert('hello')"),
};
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
Assert.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
Assert.assertTrue(sw.toString().contains("<meter "));
Assert.assertTrue(sw.toString().contains("</meter>"));
// TEST 4
sw = new StringWriter();
mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
facesContext.setResponseWriter(mrw);
boxDiv4.encodeAll(facesContext);
sw.flush();
attrs = new HtmlRenderedAttr[]{
new HtmlRenderedAttr("class", "noprint"),
};
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{
Assert.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, sw.toString()));
}
Assert.assertTrue(sw.toString().contains("MYBOX4"));
Assert.assertTrue(sw.toString().contains("<div "));
Assert.assertTrue(sw.toString().contains("</div>"));
// TEST 5
sw = new StringWriter();
mrw = new HtmlResponseWriterImpl(sw, "text/html", "UTF-8");
facesContext.setResponseWriter(mrw);
boxDiv5.encodeAll(facesContext);
sw.flush();
attrs = new HtmlRenderedAttr[]{
new HtmlRenderedAttr("style", "noprint"),
};
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
if(HtmlCheckAttributesUtil.hasFailedAttrRender(attrs))
{