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 2010/07/29 00:35:02 UTC
svn commit: r980256 -
/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/
Author: lu4242
Date: Wed Jul 28 22:35:01 2010
New Revision: 980256
URL: http://svn.apache.org/viewvc?rev=980256&view=rev
Log:
MYFACES-2844 Create tests for clientEvent properties
Added:
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AbstractClientBehaviorTestCase.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlBodyClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlClientEventAttributesUtil.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandButtonClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandLinkClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlDataTableClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlFormClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlGraphicImageClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetButtonClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetLinkClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLabelClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLinkClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlPanelGridClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlRenderedClientEventAttr.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSecretClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectBooleanCheckboxClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyCheckboxClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyListboxClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyMenuClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneListboxClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneMenuClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneRadioClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextClientBehaviorRendererTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextareaClientBehaviorRendererTest.java
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AbstractClientBehaviorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AbstractClientBehaviorTestCase.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AbstractClientBehaviorTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/AbstractClientBehaviorTestCase.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,206 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import java.io.StringWriter;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.AjaxBehavior;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.shared_impl.renderkit.html.HtmlResponseWriterImpl;
+import org.apache.myfaces.shared_impl.util.FastWriter;
+import org.apache.myfaces.test.base.junit4.AbstractJsfTestCase;
+import org.apache.myfaces.test.config.ConfigParser;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public abstract class AbstractClientBehaviorTestCase extends AbstractJsfTestCase
+{
+ protected ResponseWriter writer;
+ protected FastWriter outputWriter;
+ protected ConfigParser parser;
+
+ //protected abstract UIComponent getComponentToTest();
+
+ protected abstract HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes();
+
+ protected abstract UIComponent createComponentToTest();
+
+ @Override
+ protected void setUpJSFObjects() throws Exception
+ {
+ super.setUpJSFObjects();
+ outputWriter = new FastWriter();
+ writer = new HtmlResponseWriterImpl(outputWriter, null, null);
+ facesContext.setResponseWriter(writer);
+ facesContext.getAttributes().put("org.apache.myfaces.RENDERED_JSF_JS", true);
+ }
+
+ @Override
+ protected void setUpApplication() throws Exception
+ {
+ super.setUpApplication();
+ }
+
+ @Override
+ protected void setUpRenderKit() throws Exception
+ {
+ super.setUpRenderKit();
+ parser = new ConfigParser();
+ parser.parse(parser.getPlatformURLs());
+ //parser.parse(this.getClass().getResource("/META-INF/faces-config.xml"));
+ }
+
+ /**
+ * Components that render client behaviors should always render "id" and "name" attribute
+ */
+ @Test
+ public void testClientBehaviorHolderRendersIdAndName()
+ {
+ HtmlRenderedClientEventAttr[] attrs = getClientBehaviorHtmlRenderedAttributes();
+
+ for (int i = 0; i < attrs.length; i++)
+ {
+ UIComponent component = createComponentToTest();
+ ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
+ clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
+ try
+ {
+ component.encodeAll(facesContext);
+ String output = outputWriter.toString();
+ Assert.assertTrue(output.indexOf(" id=\""+component.getClientId(facesContext)+"\"") > -1);
+ Assert.assertTrue(output.indexOf(" name=\""+component.getClientId(facesContext)+"\"") > -1);
+ outputWriter.reset();
+ }
+ catch (Exception e)
+ {
+ Assert.fail(e.getMessage());
+ }
+ }
+ }
+
+ @Test
+ public void testClientBehaviorRendered()
+ {
+ HtmlRenderedClientEventAttr[] attrs = getClientBehaviorHtmlRenderedAttributes();
+
+ for (int i = 0; i < attrs.length; i++)
+ {
+ UIComponent component = createComponentToTest();
+ ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
+ clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
+ try
+ {
+ component.encodeAll(facesContext);
+ String output = outputWriter.toString();
+ //jsf.ajax.request('j_id0',event,{'javax.faces.behavior.event':'click'})
+ //Only check if the property starts with jsf.ajax.request( is enough
+ //Assert.assertTrue("output does not match expected output jsf.ajax.request(.... for property "+attrs[i].getName(),
+ // output.matches(".+ "+attrs[i].getName()+"=\"jsf\\.ajax\\.request\\(.+"));
+ int index = checkClientBehaviorRenderedOnClientEventProperty(output, 0, attrs[i]);
+ outputWriter.reset();
+ }
+ catch (Exception e)
+ {
+ Assert.fail(e.getMessage());
+ }
+ }
+ }
+
+ public int checkClientBehaviorRenderedOnClientEventProperty(String output, int start, HtmlRenderedClientEventAttr attr)
+ {
+ String propStart = " "+attr.getName()+"=\"";
+ int propIndex = output.indexOf(propStart, start);
+ if (propIndex > -1)
+ {
+ int c = '"';
+ int startPropIndex = propIndex + propStart.length();
+ int endPropIndex = output.indexOf('"' , startPropIndex );
+ String propertyValue = output.substring(startPropIndex, endPropIndex);
+ Assert.assertTrue("Property: " + attr.getName()+" Output: "+output, propertyValue.contains("jsf.ajax.request("));
+ Assert.assertTrue("Property: " + attr.getName()+" Output: "+output, propertyValue.contains("javax.faces.behavior.event"));
+ Assert.assertTrue("Property: " + attr.getName()+" Output: "+output, propertyValue.contains(attr.getClientEvent()));
+ return endPropIndex + 1;
+ }
+ else
+ {
+ Assert.fail("Property " + attr.getName() + "not found");
+ return -1;
+ }
+ }
+
+ @Test
+ public void testClientBehaviorRenderedWithHtmlAttribute()
+ {
+ HtmlRenderedClientEventAttr[] attrs = getClientBehaviorHtmlRenderedAttributes();
+
+ for (int i = 0; i < attrs.length; i++)
+ {
+ UIComponent component = createComponentToTest();
+ ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
+ clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
+ component.getAttributes().put(attrs[i].getName(), "htmlValue");
+ try
+ {
+ component.encodeAll(facesContext);
+ String output = outputWriter.toString();
+ //jsf.ajax.request('j_id0',event,{'javax.faces.behavior.event':'click'})
+ //Only check if the property starts with jsf.ajax.request( is enough
+ //Assert.assertTrue("output does not match expected output jsf.ajax.request(.... for property "+attrs[i].getName(),
+ // output.matches(".+ "+attrs[i].getName()+"=\"jsf\\.ajax\\.request\\(.+"));
+ int index = checkClientBehaviorRenderedOnClientEventPropertyAndHtmlValue(output, 0, attrs[i], "htmlValue");
+ outputWriter.reset();
+ }
+ catch (Exception e)
+ {
+ Assert.fail(e.getMessage());
+ }
+ }
+ }
+
+ public int checkClientBehaviorRenderedOnClientEventPropertyAndHtmlValue(String output, int start, HtmlRenderedClientEventAttr attr, String value)
+ {
+ String propStart = " "+attr.getName()+"=\"";
+ int propIndex = output.indexOf(propStart, start);
+ if (propIndex > -1)
+ {
+ int c = '"';
+ int startPropIndex = propIndex + propStart.length();
+ int endPropIndex = output.indexOf('"' , startPropIndex );
+ String propertyValue = output.substring(startPropIndex, endPropIndex);
+ Assert.assertTrue("Property: " + attr.getName()+" Output: "+output, propertyValue.startsWith("jsf.util.chain("));
+ Assert.assertTrue("Property: " + attr.getName()+" Output: "+output, propertyValue.contains("jsf.ajax.request("));
+ Assert.assertTrue("Property: " + attr.getName()+" Output: "+output, propertyValue.contains("javax.faces.behavior.event"));
+ Assert.assertTrue("Property: " + attr.getName()+" Output: "+output, propertyValue.contains(attr.getClientEvent()));
+ Assert.assertTrue("Property: " + attr.getName()+" Output: "+output, propertyValue.contains(value));
+ return endPropIndex + 1;
+ }
+ else
+ {
+ Assert.fail("Property " + attr.getName() + "not found"+" Output: "+output);
+ return -1;
+ }
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlBodyClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlBodyClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlBodyClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlBodyClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,98 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.AjaxBehavior;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.component.html.HtmlBody;
+
+import org.apache.myfaces.shared_impl.renderkit.ClientBehaviorEvents;
+import org.apache.myfaces.shared_impl.renderkit.html.HTML;
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+import org.junit.Assert;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlBodyClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = (HtmlRenderedClientEventAttr[])
+ org.apache.myfaces.shared_impl.util.ArrayUtils.concat(
+ HtmlClientEventAttributesUtil.generateClientBehaviorEventAttrs(),
+ new HtmlRenderedClientEventAttr[]{
+ new HtmlRenderedClientEventAttr(HTML.ONLOAD_ATTR, ClientBehaviorEvents.LOAD),
+ new HtmlRenderedClientEventAttr(HTML.ONUNLOAD_ATTR, ClientBehaviorEvents.UNLOAD)
+ });
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlBody();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+
+ /**
+ * Components that render client behaviors should always render "id" and "name" attribute
+ * <body> does not have "name", so we just need to check "id"
+ */
+ public void testClientBehaviorHolderRendersIdAndName()
+ {
+ HtmlRenderedClientEventAttr[] attrs = getClientBehaviorHtmlRenderedAttributes();
+
+ for (int i = 0; i < attrs.length; i++)
+ {
+ UIComponent component = createComponentToTest();
+ ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
+ clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
+ try
+ {
+ component.encodeAll(facesContext);
+ String output = outputWriter.toString();
+ Assert.assertTrue(output.matches(".+ id=\".+\".+"));
+ outputWriter.reset();
+ }
+ catch (Exception e)
+ {
+ Assert.fail(e.getMessage());
+ }
+ }
+ }
+
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlClientEventAttributesUtil.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlClientEventAttributesUtil.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlClientEventAttributesUtil.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlClientEventAttributesUtil.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import org.apache.myfaces.shared_impl.renderkit.ClientBehaviorEvents;
+import org.apache.myfaces.shared_impl.renderkit.html.HTML;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlClientEventAttributesUtil
+{
+ public static HtmlRenderedClientEventAttr[] generateClientBehaviorEventAttrs()
+ {
+ HtmlRenderedClientEventAttr[] attrs = new HtmlRenderedClientEventAttr[]{
+ new HtmlRenderedClientEventAttr(HTML.ONCLICK_ATTR, ClientBehaviorEvents.CLICK),
+ new HtmlRenderedClientEventAttr(HTML.ONDBLCLICK_ATTR, ClientBehaviorEvents.DBLCLICK),
+ new HtmlRenderedClientEventAttr(HTML.ONKEYDOWN_ATTR, ClientBehaviorEvents.KEYDOWN),
+ new HtmlRenderedClientEventAttr(HTML.ONKEYPRESS_ATTR, ClientBehaviorEvents.KEYPRESS),
+ new HtmlRenderedClientEventAttr(HTML.ONKEYUP_ATTR, ClientBehaviorEvents.KEYUP),
+ new HtmlRenderedClientEventAttr(HTML.ONMOUSEDOWN_ATTR, ClientBehaviorEvents.MOUSEDOWN),
+ new HtmlRenderedClientEventAttr(HTML.ONMOUSEMOVE_ATTR, ClientBehaviorEvents.MOUSEMOVE),
+ new HtmlRenderedClientEventAttr(HTML.ONMOUSEOUT_ATTR, ClientBehaviorEvents.MOUSEOUT),
+ new HtmlRenderedClientEventAttr(HTML.ONMOUSEOVER_ATTR, ClientBehaviorEvents.MOUSEOVER),
+ new HtmlRenderedClientEventAttr(HTML.ONMOUSEUP_ATTR, ClientBehaviorEvents.MOUSEUP)
+ };
+
+ return attrs;
+ }
+
+ public static HtmlRenderedClientEventAttr[] generateClientBehaviorInputEventAttrs()
+ {
+ return (HtmlRenderedClientEventAttr[])
+ org.apache.myfaces.shared_impl.util.ArrayUtils.concat(
+ generateClientBehaviorEventAttrs(),
+ new HtmlRenderedClientEventAttr[]{
+ new HtmlRenderedClientEventAttr(HTML.ONBLUR_ATTR, ClientBehaviorEvents.BLUR),
+ new HtmlRenderedClientEventAttr(HTML.ONFOCUS_ATTR, ClientBehaviorEvents.FOCUS),
+ new HtmlRenderedClientEventAttr(HTML.ONSELECT_ATTR, ClientBehaviorEvents.SELECT),
+ new HtmlRenderedClientEventAttr(HTML.ONCHANGE_ATTR, ClientBehaviorEvents.CHANGE),
+ new HtmlRenderedClientEventAttr(HTML.ONCHANGE_ATTR, ClientBehaviorEvents.VALUECHANGE)
+ });
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandButtonClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandButtonClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandButtonClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandButtonClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,80 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlCommandButton;
+import javax.faces.component.html.HtmlOutcomeTargetButton;
+
+import org.apache.myfaces.application.NavigationHandlerImpl;
+import org.apache.myfaces.shared_impl.renderkit.ClientBehaviorEvents;
+import org.apache.myfaces.shared_impl.renderkit.html.HTML;
+import org.apache.myfaces.shared_impl.util.ArrayUtils;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlCommandButtonClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = (HtmlRenderedClientEventAttr[])
+ ArrayUtils.concat(HtmlClientEventAttributesUtil.generateClientBehaviorEventAttrs(),
+ new HtmlRenderedClientEventAttr[]{
+ new HtmlRenderedClientEventAttr(HTML.ONFOCUS_ATTR, ClientBehaviorEvents.FOCUS),
+ new HtmlRenderedClientEventAttr(HTML.ONBLUR_ATTR, ClientBehaviorEvents.BLUR),
+ new HtmlRenderedClientEventAttr(HTML.ONSELECT_ATTR, ClientBehaviorEvents.SELECT),
+ new HtmlRenderedClientEventAttr(HTML.ONCHANGE_ATTR, ClientBehaviorEvents.CHANGE),
+ new HtmlRenderedClientEventAttr(HTML.ONCLICK_ATTR, ClientBehaviorEvents.ACTION)
+ });
+ }
+
+
+
+ @Override
+ protected void setUpApplication() throws Exception
+ {
+ super.setUpApplication();
+ application.setNavigationHandler(new NavigationHandlerImpl());
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlCommandButton();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandLinkClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandLinkClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandLinkClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlCommandLinkClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,82 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlCommandLink;
+import javax.faces.component.html.HtmlForm;
+
+import org.apache.myfaces.application.NavigationHandlerImpl;
+import org.apache.myfaces.shared_impl.renderkit.ClientBehaviorEvents;
+import org.apache.myfaces.shared_impl.renderkit.html.HTML;
+import org.apache.myfaces.shared_impl.util.ArrayUtils;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlCommandLinkClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = (HtmlRenderedClientEventAttr[])
+ ArrayUtils.concat(HtmlClientEventAttributesUtil.generateClientBehaviorEventAttrs(),
+ new HtmlRenderedClientEventAttr[]{
+ new HtmlRenderedClientEventAttr(HTML.ONFOCUS_ATTR, ClientBehaviorEvents.FOCUS),
+ new HtmlRenderedClientEventAttr(HTML.ONBLUR_ATTR, ClientBehaviorEvents.BLUR),
+ new HtmlRenderedClientEventAttr(HTML.ONCLICK_ATTR, ClientBehaviorEvents.ACTION)
+ });
+ }
+
+
+
+ @Override
+ protected void setUpApplication() throws Exception
+ {
+ super.setUpApplication();
+ application.setNavigationHandler(new NavigationHandlerImpl());
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ UIComponent component = new HtmlCommandLink();
+ UIComponent form = new HtmlForm();
+ form.getChildren().add(component);
+ facesContext.getViewRoot().getChildren().add(form);
+ return component;
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlDataTableClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlDataTableClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlDataTableClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlDataTableClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlGraphicImage;
+import javax.faces.component.html.HtmlPanelGrid;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlDataTableClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlDataTable();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlFormClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlFormClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlFormClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlFormClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,60 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlGraphicImage;
+import javax.faces.component.html.HtmlPanelGrid;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlFormClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlForm();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlGraphicImageClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlGraphicImageClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlGraphicImageClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlGraphicImageClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,59 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlGraphicImage;
+import javax.faces.component.html.HtmlPanelGrid;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlGraphicImageClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlGraphicImage();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetButtonClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetButtonClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetButtonClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetButtonClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,76 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlOutcomeTargetButton;
+
+import org.apache.myfaces.application.NavigationHandlerImpl;
+import org.apache.myfaces.shared_impl.renderkit.ClientBehaviorEvents;
+import org.apache.myfaces.shared_impl.renderkit.html.HTML;
+import org.apache.myfaces.shared_impl.util.ArrayUtils;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlOutcomeTargetButtonClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = (HtmlRenderedClientEventAttr[])
+ ArrayUtils.concat(HtmlClientEventAttributesUtil.generateClientBehaviorEventAttrs(),
+ new HtmlRenderedClientEventAttr[]{
+ new HtmlRenderedClientEventAttr(HTML.ONFOCUS_ATTR, ClientBehaviorEvents.FOCUS),
+ new HtmlRenderedClientEventAttr(HTML.ONBLUR_ATTR, ClientBehaviorEvents.BLUR)
+ });
+ }
+
+
+
+ @Override
+ protected void setUpApplication() throws Exception
+ {
+ super.setUpApplication();
+ application.setNavigationHandler(new NavigationHandlerImpl());
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlOutcomeTargetButton();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetLinkClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetLinkClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetLinkClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutcomeTargetLinkClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,77 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlOutcomeTargetLink;
+import javax.faces.component.html.HtmlOutputLink;
+
+import org.apache.myfaces.application.NavigationHandlerImpl;
+import org.apache.myfaces.shared_impl.renderkit.ClientBehaviorEvents;
+import org.apache.myfaces.shared_impl.renderkit.html.HTML;
+import org.apache.myfaces.shared_impl.util.ArrayUtils;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlOutcomeTargetLinkClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = (HtmlRenderedClientEventAttr[])
+ ArrayUtils.concat(HtmlClientEventAttributesUtil.generateClientBehaviorEventAttrs(),
+ new HtmlRenderedClientEventAttr[]{
+ new HtmlRenderedClientEventAttr(HTML.ONFOCUS_ATTR, ClientBehaviorEvents.FOCUS),
+ new HtmlRenderedClientEventAttr(HTML.ONBLUR_ATTR, ClientBehaviorEvents.BLUR)
+ });
+ }
+
+
+
+ @Override
+ protected void setUpApplication() throws Exception
+ {
+ super.setUpApplication();
+ application.setNavigationHandler(new NavigationHandlerImpl());
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlOutcomeTargetLink();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLabelClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLabelClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLabelClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLabelClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,68 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlOutputLabel;
+import javax.faces.component.html.HtmlPanelGrid;
+
+import org.apache.myfaces.shared_impl.renderkit.ClientBehaviorEvents;
+import org.apache.myfaces.shared_impl.renderkit.html.HTML;
+import org.apache.myfaces.shared_impl.util.ArrayUtils;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlOutputLabelClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = (HtmlRenderedClientEventAttr[])
+ ArrayUtils.concat(HtmlClientEventAttributesUtil.generateClientBehaviorEventAttrs(),
+ new HtmlRenderedClientEventAttr[]{
+ new HtmlRenderedClientEventAttr(HTML.ONFOCUS_ATTR, ClientBehaviorEvents.FOCUS),
+ new HtmlRenderedClientEventAttr(HTML.ONBLUR_ATTR, ClientBehaviorEvents.BLUR)
+ });
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlOutputLabel();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLinkClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLinkClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLinkClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlOutputLinkClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,67 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlOutputLink;
+
+import org.apache.myfaces.shared_impl.renderkit.ClientBehaviorEvents;
+import org.apache.myfaces.shared_impl.renderkit.html.HTML;
+import org.apache.myfaces.shared_impl.util.ArrayUtils;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlOutputLinkClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = (HtmlRenderedClientEventAttr[])
+ ArrayUtils.concat(HtmlClientEventAttributesUtil.generateClientBehaviorEventAttrs(),
+ new HtmlRenderedClientEventAttr[]{
+ new HtmlRenderedClientEventAttr(HTML.ONFOCUS_ATTR, ClientBehaviorEvents.FOCUS),
+ new HtmlRenderedClientEventAttr(HTML.ONBLUR_ATTR, ClientBehaviorEvents.BLUR)
+ });
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlOutputLink();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlPanelGridClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlPanelGridClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlPanelGridClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlPanelGridClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,58 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlPanelGrid;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlPanelGridClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlPanelGrid();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlRenderedClientEventAttr.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlRenderedClientEventAttr.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlRenderedClientEventAttr.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlRenderedClientEventAttr.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,70 @@
+/*
+ * 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.renderkit.html.behavior;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlRenderedClientEventAttr
+{
+ private String name;
+ private String clientEvent;
+ private String value;
+
+ public HtmlRenderedClientEventAttr(String name, String clientEvent) {
+ this(name, clientEvent, name);
+ }
+
+ public HtmlRenderedClientEventAttr(String name, String clientEvent, String value) {
+ this.name = name;
+ this.clientEvent = clientEvent;
+ this.value = value;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getClientEvent()
+ {
+ return clientEvent;
+ }
+
+ public void setClientEvent(String clientEvent)
+ {
+ this.clientEvent = clientEvent;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSecretClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSecretClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSecretClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSecretClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,60 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlInputSecret;
+
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlSecretClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorInputEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlInputSecret();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectBooleanCheckboxClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectBooleanCheckboxClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectBooleanCheckboxClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectBooleanCheckboxClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,60 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlSelectBooleanCheckbox;
+
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlSelectBooleanCheckboxClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorInputEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlSelectBooleanCheckbox();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyCheckboxClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyCheckboxClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyCheckboxClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyCheckboxClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,92 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UISelectItem;
+import javax.faces.component.behavior.AjaxBehavior;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.component.html.HtmlSelectManyCheckbox;
+
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+import org.junit.Assert;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlSelectManyCheckboxClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorInputEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ UIComponent component = new HtmlSelectManyCheckbox();
+ UISelectItem item = new UISelectItem();
+ item.setItemValue("value1");
+ component.getChildren().add(item);
+ return component;
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+
+ public void testClientBehaviorHolderRendersIdAndName()
+ {
+ HtmlRenderedClientEventAttr[] attrs = getClientBehaviorHtmlRenderedAttributes();
+
+ for (int i = 0; i < attrs.length; i++)
+ {
+ UIComponent component = createComponentToTest();
+ ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
+ clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
+ try
+ {
+ component.encodeAll(facesContext);
+ String output = outputWriter.toString();
+ Assert.assertTrue(output.matches(".+ id=\".+\".+"));
+ Assert.assertTrue(output.matches(".+ name=\".+\".+"));
+ outputWriter.reset();
+ }
+ catch (Exception e)
+ {
+ Assert.fail(e.getMessage());
+ }
+ }
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyListboxClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyListboxClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyListboxClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyListboxClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,66 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UISelectItem;
+import javax.faces.component.html.HtmlSelectManyCheckbox;
+import javax.faces.component.html.HtmlSelectManyListbox;
+
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlSelectManyListboxClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorInputEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ UIComponent component = new HtmlSelectManyListbox();
+ UISelectItem item = new UISelectItem();
+ item.setItemValue("value1");
+ component.getChildren().add(item);
+ return component;
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyMenuClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyMenuClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyMenuClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectManyMenuClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UISelectItem;
+import javax.faces.component.html.HtmlSelectManyMenu;
+
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlSelectManyMenuClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorInputEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ UIComponent component = new HtmlSelectManyMenu();
+ UISelectItem item = new UISelectItem();
+ item.setItemValue("value1");
+ component.getChildren().add(item);
+ return component;
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneListboxClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneListboxClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneListboxClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneListboxClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,66 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UISelectItem;
+import javax.faces.component.html.HtmlSelectOneListbox;
+import javax.faces.component.html.HtmlSelectOneMenu;
+
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlSelectOneListboxClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorInputEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ UIComponent component = new HtmlSelectOneListbox();
+ UISelectItem item = new UISelectItem();
+ item.setItemValue("value1");
+ component.getChildren().add(item);
+ return component;
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneMenuClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneMenuClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneMenuClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneMenuClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UISelectItem;
+import javax.faces.component.html.HtmlSelectOneMenu;
+
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlSelectOneMenuClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorInputEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ UIComponent component = new HtmlSelectOneMenu();
+ UISelectItem item = new UISelectItem();
+ item.setItemValue("value1");
+ component.getChildren().add(item);
+ return component;
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneRadioClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneRadioClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneRadioClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlSelectOneRadioClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,92 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UISelectItem;
+import javax.faces.component.behavior.AjaxBehavior;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.component.html.HtmlSelectOneRadio;
+
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+import org.junit.Assert;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlSelectOneRadioClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorInputEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ UIComponent component = new HtmlSelectOneRadio();
+ UISelectItem item = new UISelectItem();
+ item.setItemValue("value1");
+ component.getChildren().add(item);
+ return component;
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+
+ public void testClientBehaviorHolderRendersIdAndName()
+ {
+ HtmlRenderedClientEventAttr[] attrs = getClientBehaviorHtmlRenderedAttributes();
+
+ for (int i = 0; i < attrs.length; i++)
+ {
+ UIComponent component = createComponentToTest();
+ ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component;
+ clientBehaviorHolder.addClientBehavior(attrs[i].getClientEvent(), new AjaxBehavior());
+ try
+ {
+ component.encodeAll(facesContext);
+ String output = outputWriter.toString();
+ Assert.assertTrue(output.matches(".+ id=\".+\".+"));
+ Assert.assertTrue(output.matches(".+ name=\".+\".+"));
+ outputWriter.reset();
+ }
+ catch (Exception e)
+ {
+ Assert.fail(e.getMessage());
+ }
+ }
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,60 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlInputText;
+
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlTextClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorInputEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlInputText();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextareaClientBehaviorRendererTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextareaClientBehaviorRendererTest.java?rev=980256&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextareaClientBehaviorRendererTest.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/renderkit/html/behavior/HtmlTextareaClientBehaviorRendererTest.java Wed Jul 28 22:35:01 2010
@@ -0,0 +1,60 @@
+/*
+ * 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.renderkit.html.behavior;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlInputTextarea;
+
+import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author: jankeesvanandel $)
+ * @version $Revision: 799929 $ $Date: 2009-08-01 16:29:33 -0500 (sáb, 01 ago 2009) $
+ */
+public class HtmlTextareaClientBehaviorRendererTest extends AbstractClientBehaviorTestCase
+{
+ private HtmlRenderedClientEventAttr[] attrs = null;
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ attrs = HtmlClientEventAttributesUtil.generateClientBehaviorInputEventAttrs();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ attrs = null;
+ }
+
+
+ @Override
+ protected UIComponent createComponentToTest()
+ {
+ return new HtmlInputTextarea();
+ }
+
+ @Override
+ protected HtmlRenderedClientEventAttr[] getClientBehaviorHtmlRenderedAttributes()
+ {
+ return attrs;
+ }
+}