Author: ppitonak(a)redhat.com
Date: 2011-01-13 08:22:44 -0500 (Thu, 13 Jan 2011)
New Revision: 20982
Added:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichMenuItemBean.properties
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/simple.xhtml
modules/tests/metamer/trunk/ftest/src/test/resources/testng-core.xml
modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml
modules/tests/metamer/trunk/ftest/src/test/resources/testng-output.xml
Log:
https://issues.jboss.org/browse/RFPL-958
* added 30 tests for rich:menuItem
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java 2011-01-13
11:50:08 UTC (rev 20981)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichMenuItemBean.java 2011-01-13
13:22:44 UTC (rev 20982)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -58,6 +58,9 @@
attributes.setAttribute("label", "New");
attributes.setAttribute("mode", "ajax");
attributes.setAttribute("rendered", true);
+
+ attributes.remove("action");
+ attributes.remove("actionListener");
}
public Attributes getAttributes() {
Added:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichMenuItemBean.properties
===================================================================
---
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichMenuItemBean.properties
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichMenuItemBean.properties 2011-01-13
13:22:44 UTC (rev 20982)
@@ -0,0 +1,15 @@
+attr.dir.ltr=ltr
+attr.dir.rtl=rtl
+attr.dir.null=
+
+attr.icon.createdoc=/resources/images/icons/create_doc.gif
+attr.icon.star=/resources/images/star.png
+attr.icon.heart=/resources/images/heart.png
+attr.icon.nonexisting=nonexisting
+attr.icon.null=
+
+attr.iconDisabled.createdoc=/resources/images/icons/create_doc.gif
+attr.iconDisabled.star=/resources/images/star.png
+attr.iconDisabled.heart=/resources/images/heart.png
+attr.iconDisabled.nonexisting=nonexisting
+attr.iconDisabled.null=
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/simple.xhtml 2011-01-13
11:50:08 UTC (rev 20981)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richMenuItem/simple.xhtml 2011-01-13
13:22:44 UTC (rev 20982)
@@ -6,7 +6,7 @@
<!--
JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
by the @authors tag. See the copyright.txt in the distribution for a
full listing of individual contributors.
@@ -62,9 +62,10 @@
</h:panelGroup>
</f:facet>
- <rich:menuItem id="menuItem"
+ <rich:menuItem id="menuItem1"
action="#{richBean.dummyAction}"
actionListener="#{richBean.dummyActionListener}"
+
bypassUpdates="#{richMenuItemBean.attributes['bypassUpdates'].value}"
data="#{richMenuItemBean.attributes['data'].value}"
dir="#{richMenuItemBean.attributes['dir'].value}"
disabled="#{richMenuItemBean.attributes['disabled'].value}"
@@ -98,11 +99,11 @@
value="#{richMenuItemBean.attributes['value'].value}"
/>
- <rich:menuItem label="Open"
icon="/resources/images/icons/open.gif" />
+ <rich:menuItem id="menuItem2" label="Open"
icon="/resources/images/icons/open.gif" />
- <rich:menuGroup label="Open Recent..."
disabled="true">
- <rich:menuItem label="Save"
icon="/resources/images/icons/save.gif" />
- <rich:menuItem label="Save All">
+ <rich:menuGroup id="menuGroup3" label="Open
Recent..." disabled="true">
+ <rich:menuItem id="menuItem31"
label="Save" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem32" label="Save
All">
<f:facet name="icon">
<h:graphicImage library="images/icons"
name="save_all.gif" />
</f:facet>
@@ -111,23 +112,23 @@
<rich:menuSeparator id="menuSeparator11" />
- <rich:menuGroup id="menuGroup" label="Save
As...">
- <rich:menuItem label="Save"
icon="/resources/images/icons/save.gif" />
- <rich:menuItem label="Save All" >
+ <rich:menuGroup id="menuGroup4" label="Save
As...">
+ <rich:menuItem id="menuItem41"
label="Save" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem42" label="Save
All" >
<f:facet name="icon">
<h:graphicImage library="images/icons"
name="save_all.gif" />
</f:facet>
</rich:menuItem>
- <rich:menuItem label="Send Online"
icon="/resources/images/icons/save.gif" disabled="true" />
+ <rich:menuItem id="menuItem43" label="Send
Online" icon="/resources/images/icons/save.gif" disabled="true"
/>
</rich:menuGroup>
- <rich:menuItem label="Print"
disabled="true"/>
+ <rich:menuItem id="menuItem5" label="Print"
disabled="true"/>
- <rich:menuItem label="Close" />
+ <rich:menuItem id="menuItem6" label="Close"
/>
<rich:menuSeparator id="menuSeparator12" />
- <rich:menuItem label="Exit" />
+ <rich:menuItem id="menuItem7" label="Exit"
/>
</rich:dropDownMenu>
Modified: modules/tests/metamer/trunk/ftest/src/test/resources/testng-core.xml
===================================================================
--- modules/tests/metamer/trunk/ftest/src/test/resources/testng-core.xml 2011-01-13
11:50:08 UTC (rev 20981)
+++ modules/tests/metamer/trunk/ftest/src/test/resources/testng-core.xml 2011-01-13
13:22:44 UTC (rev 20982)
@@ -10,7 +10,9 @@
<package name="org.richfaces.tests.metamer.ftest.a4jCommandLink"
/>
<package name="org.richfaces.tests.metamer.ftest.a4jJSFunction"
/>
<package name="org.richfaces.tests.metamer.ftest.a4jLog" />
+ <package name="org.richfaces.tests.metamer.ftest.a4jMediaOutput"
/>
<package name="org.richfaces.tests.metamer.ftest.a4jOutputPanel"
/>
+ <package name="org.richfaces.tests.metamer.ftest.a4jParam"
/>
<package name="org.richfaces.tests.metamer.ftest.a4jPoll" />
<package name="org.richfaces.tests.metamer.ftest.a4jQueue"
/>
<package name="org.richfaces.tests.metamer.ftest.a4jRegion"
/>
Modified: modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml
===================================================================
--- modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml 2011-01-13
11:50:08 UTC (rev 20981)
+++ modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml 2011-01-13
13:22:44 UTC (rev 20982)
@@ -8,6 +8,7 @@
<package
name="org.richfaces.tests.metamer.ftest.richDataScroller" />
<package name="org.richfaces.tests.metamer.ftest.richFunctions"
/>
<package name="org.richfaces.tests.metamer.ftest.richJQuery"
/>
+ <package name="org.richfaces.tests.metamer.ftest.richMenuItem"
/>
<package
name="org.richfaces.tests.metamer.ftest.richMenuSeparator" />
<package
name="org.richfaces.tests.metamer.ftest.richToggleControl" />
</packages>
Modified: modules/tests/metamer/trunk/ftest/src/test/resources/testng-output.xml
===================================================================
--- modules/tests/metamer/trunk/ftest/src/test/resources/testng-output.xml 2011-01-13
11:50:08 UTC (rev 20981)
+++ modules/tests/metamer/trunk/ftest/src/test/resources/testng-output.xml 2011-01-13
13:22:44 UTC (rev 20982)
@@ -10,6 +10,8 @@
<package name="org.richfaces.tests.metamer.ftest.richTabPanel"
/>
<package
name="org.richfaces.tests.metamer.ftest.richTogglePanel" />
<package
name="org.richfaces.tests.metamer.ftest.richTogglePanelItem" />
+ <package name="org.richfaces.tests.metamer.ftest.richToolbar"
/>
+ <package
name="org.richfaces.tests.metamer.ftest.richToolbarGroup" />
</packages>
</test>
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java 2011-01-13
13:22:44 UTC (rev 20982)
@@ -0,0 +1,400 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richMenuItem;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
+import static
org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.locator.option.OptionLocatorFactory.optionLabel;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotSame;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.net.URL;
+import javax.faces.event.PhaseId;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/richMenuItem/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestRichMenuItem extends AbstractMetamerTest {
+
+ private JQueryLocator fileMenu = pjq("div[id$=menu1]");
+ private JQueryLocator menuItem1 = pjq("div[id$=menuItem1]");
+ private JQueryLocator image = menuItem1.getDescendant(jq("img"));
+ private JQueryLocator label =
menuItem1.getDescendant(jq("span.rf-ddm-itm-lbl"));
+ private JQueryLocator menuItem2 = pjq("div[id$=menuItem2]");
+ private JQueryLocator menuGroup3 = pjq("div[id$=menuGroup3]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richMenuItem/simple.xhtml");
+ }
+
+ @Test
+ public void testInit() {
+ assertTrue(selenium.isElementPresent(fileMenu), "Drop down menu
\"File\" should be present on the page.");
+ assertTrue(selenium.isVisible(fileMenu), "Drop down menu \"File\"
should be visible on the page.");
+
+ assertTrue(selenium.isElementPresent(menuItem1), "Menu item
\"New\" should be present on the page.");
+ assertFalse(selenium.isVisible(menuItem1), "Menu item \"New\"
should not be visible on the page.");
+
+ guardNoRequest(selenium).click(fileMenu);
+
+ assertTrue(selenium.isElementPresent(menuItem1), "Menu item
\"New\" should be present on the page.");
+ assertTrue(selenium.isVisible(menuItem1), "Menu item \"New\"
should be visible on the page.");
+
+ assertTrue(selenium.isElementPresent(menuItem2), "Menu item
\"Open\" should be present on the page.");
+ assertTrue(selenium.isVisible(menuItem2), "Menu item \"Open\"
should be visible on the page.");
+
+ assertTrue(selenium.isElementPresent(menuGroup3), "Menu group \"Open
Recent...\" should be present on the page.");
+ assertTrue(selenium.isVisible(menuGroup3), "Menu group \"Open
Recent...\" should be visible on the page.");
+
+ assertTrue(selenium.isElementPresent(image), "Icon of menu item 1 should be
present on the page.");
+ assertTrue(selenium.isVisible(image), "Icon of menu item 1 should be visible
on the page.");
+
+ assertTrue(selenium.isElementPresent(label), "Label of menu item 1 should be
present on the page.");
+ assertTrue(selenium.isVisible(label), "Label of menu item 1 should be
visible on the page.");
+
+ assertEquals(selenium.getText(label), "New", "Label of first menu
item.");
+ AttributeLocator attr = image.getAttribute(Attribute.SRC);
+ assertTrue(selenium.getAttribute(attr).contains("create_doc.gif"),
"Image's src attribute should contain \"create_doc.gif\".");
+ }
+
+ @Test
+ public void testAction() {
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ String listenerOutput = selenium.getText(jq("div#phasesPanel
li:eq(6)"));
+ assertEquals(listenerOutput, "* action invoked", "Action's
output");
+ }
+
+ @Test
+ public void testActionListener() {
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ String listenerOutput = selenium.getText(jq("div#phasesPanel
li:eq(5)"));
+ assertEquals(listenerOutput, "* action listener invoked", "Action
listener's output");
+ }
+
+ @Test
+ public void testBypassUpdates() {
+
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.RENDER_RESPONSE);
+
+ String listenerOutput = selenium.getText(jq("div#phasesPanel
li:eq(3)"));
+ assertEquals(listenerOutput, "* action listener invoked", "Action
listener's output");
+ listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(4)"));
+ assertEquals(listenerOutput, "* action invoked", "Action's
output");
+ }
+
+ @Test
+ public void testData() {
+ selenium.type(pjq("input[type=text][id$=dataInput]"), "RichFaces
4");
+ selenium.waitForPageToLoad();
+
+ selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data
= event.data");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ String data = selenium.getEval(new JavaScript("window.data"));
+ assertEquals(data, "RichFaces 4", "Data sent with ajax
request");
+ }
+
+ @Test
+ public void testDir() {
+ testDir(menuItem1);
+ }
+
+ @Test
+ public void testDisabled() {
+
selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ assertTrue(selenium.belongsClass(menuItem1, "rf-ddm-itm-dis"),
"Menu item should have class \"rf-ddm-itm-dis\".");
+
assertTrue(selenium.isElementPresent(menuItem1.getDescendant(jq("div.rf-ddm-emptyIcon"))),
"Empty icon should be present.");
+ assertFalse(selenium.isElementPresent(image), "Icon should not be
present.");
+ }
+
+ @Test
+ public void testExecute() {
+ selenium.type(pjq("input[type=text][id$=executeInput]"), "@this
executeChecker");
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ JQueryLocator logItems = jq("ul.phases-list li:eq({0})");
+ for (int i = 0; i < 6; i++) {
+ if ("*
executeChecker".equals(selenium.getText(logItems.format(i)))) {
+ return;
+ }
+ }
+
+ fail("Attribute execute does not work");
+ }
+
+ @Test
+ public void testIcon() {
+ AttributeLocator attr = image.getAttribute(Attribute.SRC);
+
+ selenium.select(pjq("select[id$=iconInput]"),
optionLabel("star"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.getAttribute(attr).contains("star.png"),
"Image's src attribute should contain \"star.png\".");
+
+ selenium.select(pjq("select[id$=iconInput]"),
optionLabel("nonexisting"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.getAttribute(attr).contains("nonexisting"),
"Image's src attribute should contain \"nonexisting\".");
+
+ selenium.select(pjq("select[id$=iconInput]"),
optionLabel("null"));
+ selenium.waitForPageToLoad();
+ assertFalse(selenium.isElementPresent(image), "Icon should not be
present.");
+
assertTrue(selenium.isElementPresent(menuItem1.getDescendant(jq("div.rf-ddm-emptyIcon"))),
"Empty icon should be present.");
+ }
+
+ @Test
+ public void testIconDisabled() {
+
selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ AttributeLocator attr = image.getAttribute(Attribute.SRC);
+
+ assertFalse(selenium.isElementPresent(image), "Icon should not be
present.");
+
assertTrue(selenium.isElementPresent(menuItem1.getDescendant(jq("div.rf-ddm-emptyIcon"))),
"Empty icon should be present.");
+
+ selenium.select(pjq("select[id$=iconDisabledInput]"),
optionLabel("star"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.getAttribute(attr).contains("star.png"),
"Image's src attribute should contain \"star.png\".");
+
+ selenium.select(pjq("select[id$=iconDisabledInput]"),
optionLabel("nonexisting"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.getAttribute(attr).contains("nonexisting"),
"Image's src attribute should contain \"nonexisting\".");
+ }
+
+ @Test
+ public void testImmediate() {
+
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.RENDER_RESPONSE);
+
+ String listenerOutput = selenium.getText(jq("div#phasesPanel
li:eq(2)"));
+ assertEquals(listenerOutput, "* action listener invoked", "Action
listener's output");
+ listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(3)"));
+ assertEquals(listenerOutput, "* action invoked", "Action's
output");
+ }
+
+ @Test
+ public void testLabel() {
+ selenium.type(pjq("input[type=text][id$=labelInput]"), "new
label");
+ selenium.waitForPageToLoad();
+
+ assertEquals(selenium.getText(label), "new label", "New label of
first menu item.");
+ }
+
+ @Test
+ public void testLang() {
+ testLang(menuItem1);
+ }
+
+ @Test
+ public void testLimitRender() {
+
selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ String timeValue = selenium.getText(time);
+
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ String newTime = selenium.getText(time);
+ assertNotSame(newTime, timeValue, "Panel with ajaxRendered=true should not
be rerendered.");
+ }
+
+ @Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10200")
+ public void testMode() {
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION,
PhaseId.RENDER_RESPONSE);
+
+ String listenerOutput = selenium.getText(jq("div#phasesPanel
li:eq(5)"));
+ assertEquals(listenerOutput, "* action listener invoked", "Action
listener's output");
+ listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(6)"));
+ assertEquals(listenerOutput, "* action invoked", "Action's
output");
+
+ selenium.type(pjq("input[id$=modeInput]"), "server");
+ selenium.waitForPageToLoad();
+
+ selenium.click(fileMenu);
+ guardHttp(selenium).click(menuItem1);
+
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION,
PhaseId.RENDER_RESPONSE);
+
+ listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(5)"));
+ assertEquals(listenerOutput, "* action listener invoked", "Action
listener's output");
+ listenerOutput = selenium.getText(jq("div#phasesPanel li:eq(6)"));
+ assertEquals(listenerOutput, "* action invoked", "Action's
output");
+ }
+
+ @Test
+ public void testEvents() {
+ selenium.type(pjq("input[type=text][id$=onbeginInput]"),
"metamerEvents += \"begin \"");
+ selenium.waitForPageToLoad();
+ selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"),
"metamerEvents += \"beforedomupdate \"");
+ selenium.waitForPageToLoad();
+ selenium.type(pjq("input[type=text][id$=oncompleteInput]"),
"metamerEvents += \"complete \"");
+ selenium.waitForPageToLoad();
+
+ selenium.getEval(new JavaScript("window.metamerEvents =
\"\";"));
+
+ String reqTime = selenium.getText(time);
+ selenium.click(fileMenu);
+ guardXhr(selenium).click(menuItem1);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ String[] events = selenium.getEval(new
JavaScript("window.metamerEvents")).split(" ");
+
+ assertEquals(events[0], "begin", "Attribute onbegin doesn't
work");
+ assertEquals(events[1], "beforedomupdate", "Attribute
onbeforedomupdate doesn't work");
+ assertEquals(events[2], "complete", "Attribute oncomplete
doesn't work");
+ }
+
+ @Test
+ public void testOnclick() {
+ testFireEvent(Event.CLICK, menuItem1);
+ }
+
+ @Test
+ public void testOndblclick() {
+ testFireEvent(Event.DBLCLICK, menuItem1);
+ }
+
+ @Test
+ public void testOnitemkeydown() {
+ testFireEvent(Event.KEYDOWN, menuItem1);
+ }
+
+ @Test
+ public void testOnitemkeypress() {
+ testFireEvent(Event.KEYPRESS, menuItem1);
+ }
+
+ @Test
+ public void testOnitemkeyup() {
+ testFireEvent(Event.KEYUP, menuItem1);
+ }
+
+ @Test
+ public void testOnmousedown() {
+ testFireEvent(Event.MOUSEDOWN, menuItem1);
+ }
+
+ @Test
+ public void testOnmousemove() {
+ testFireEvent(Event.MOUSEMOVE, menuItem1);
+ }
+
+ @Test
+ public void testOnmouseout() {
+ testFireEvent(Event.MOUSEOUT, menuItem1);
+ }
+
+ @Test
+ public void testOnmouseover() {
+ testFireEvent(Event.MOUSEOVER, menuItem1);
+ }
+
+ @Test
+ public void testOnmouseup() {
+ testFireEvent(Event.MOUSEUP, menuItem1);
+ }
+
+ @Test
+ public void testRendered() {
+
selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
+ selenium.waitForPageToLoad();
+
+ assertFalse(selenium.isElementPresent(menuItem1), "Menu item should not be
rendered when rendered=false.");
+ assertTrue(selenium.isDisplayed(menuItem1), "Menu item should be displayed
when item 1 is not rendered.");
+ }
+
+ @Test
+ public void testStyle() {
+ testStyle(menuItem1, "style");
+ }
+
+ @Test
+ public void testStyleClass() {
+ testStyleClass(menuItem1, "styleClass");
+ }
+
+ @Test
+ public void testTitle() {
+ testTitle(menuItem1);
+ }
+}
Property changes on:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMenuItem/TestRichMenuItem.java
___________________________________________________________________
Name: svn:keywords
+ Revision