Author: ppitonak(a)redhat.com
Date: 2011-01-27 08:18:22 -0500 (Thu, 27 Jan 2011)
New Revision: 21276
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsiblePanelBean.java
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichCollapsiblePanelBean.properties
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/facets.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java
Log:
https://issues.jboss.org/browse/RFPL-836
* samples for collapsible panel fixed
* added 24 new tests for collapsible panel
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsiblePanelBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsiblePanelBean.java 2011-01-27
13:16:30 UTC (rev 21275)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichCollapsiblePanelBean.java 2011-01-27
13:18:22 UTC (rev 21276)
@@ -22,9 +22,11 @@
package org.richfaces.tests.metamer.bean;
import java.io.Serializable;
+
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
+
import org.richfaces.component.UICollapsiblePanel;
import org.richfaces.event.PanelToggleEvent;
import org.richfaces.tests.metamer.Attributes;
@@ -58,13 +60,11 @@
attributes.setAttribute("rendered", true);
attributes.setAttribute("header", "collapsible panel
header");
- // TODO has to be tested in another way
- attributes.remove("changeExpandListener");
+ // will be tested in another way
attributes.remove("converter");
- attributes.remove("itemChangeListener");
- // hidden attributes
- attributes.remove("changeExpandListeners");
+ // TODO remove as soon as it is added to taglib RF-10310
+ attributes.setAttribute("onbegin", null);
}
public Attributes getAttributes() {
Modified:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichCollapsiblePanelBean.properties
===================================================================
---
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichCollapsiblePanelBean.properties 2011-01-27
13:16:30 UTC (rev 21275)
+++
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichCollapsiblePanelBean.properties 2011-01-27
13:18:22 UTC (rev 21276)
@@ -1,3 +1,55 @@
+attr.dir.ltr=ltr
+attr.dir.rtl=rtl
+attr.dir.null=
+
+attr.leftIconCollapsed.none=none
+attr.leftIconCollapsed.grid=grid
+attr.leftIconCollapsed.disc=disc
+attr.leftIconCollapsed.chevronUp=chevronUp
+attr.leftIconCollapsed.chevronDown=chevronDown
+attr.leftIconCollapsed.triangle=triangle
+attr.leftIconCollapsed.triangleUp=triangleUp
+attr.leftIconCollapsed.triangleDown=triangleDown
+attr.leftIconCollapsed.star=/resources/images/star.png
+attr.leftIconCollapsed.nonexisting=nonexisting
+attr.leftIconCollapsed.null=
+
+attr.leftIconExpanded.none=none
+attr.leftIconExpanded.grid=grid
+attr.leftIconExpanded.disc=disc
+attr.leftIconExpanded.chevronUp=chevronUp
+attr.leftIconExpanded.chevronDown=chevronDown
+attr.leftIconExpanded.triangle=triangle
+attr.leftIconExpanded.triangleUp=triangleUp
+attr.leftIconExpanded.triangleDown=triangleDown
+attr.leftIconExpanded.star=/resources/images/star.png
+attr.leftIconExpanded.nonexisting=nonexisting
+attr.leftIconExpanded.null=
+
+attr.rightIconCollapsed.none=none
+attr.rightIconCollapsed.grid=grid
+attr.rightIconCollapsed.disc=disc
+attr.rightIconCollapsed.chevronUp=chevronUp
+attr.rightIconCollapsed.chevronDown=chevronDown
+attr.rightIconCollapsed.triangle=triangle
+attr.rightIconCollapsed.triangleUp=triangleUp
+attr.rightIconCollapsed.triangleDown=triangleDown
+attr.rightIconCollapsed.star=/resources/images/star.png
+attr.rightIconCollapsed.nonexisting=nonexisting
+attr.rightIconCollapsed.null=
+
+attr.rightIconExpanded.none=none
+attr.rightIconExpanded.grid=grid
+attr.rightIconExpanded.disc=disc
+attr.rightIconExpanded.chevronUp=chevronUp
+attr.rightIconExpanded.chevronDown=chevronDown
+attr.rightIconExpanded.triangle=triangle
+attr.rightIconExpanded.triangleUp=triangleUp
+attr.rightIconExpanded.triangleDown=triangleDown
+attr.rightIconExpanded.star=/resources/images/star.png
+attr.rightIconExpanded.nonexisting=nonexisting
+attr.rightIconExpanded.null=
+
attr.switchType.client=client
attr.switchType.server=server
attr.switchType.ajax=ajax
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/facets.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/facets.xhtml 2011-01-27
13:16:30 UTC (rev 21275)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/facets.xhtml 2011-01-27
13:18:22 UTC (rev 21276)
@@ -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.
@@ -54,9 +54,12 @@
headerControlClass="#{richCollapsiblePanelBean.attributes['headerControlClass'].value}"
immediate="#{richCollapsiblePanelBean.attributes['immediate'].value}"
lang="#{richCollapsiblePanelBean.attributes['lang'].value}"
+
leftIconCollapsed="#{richCollapsiblePanelBean.attributes['leftIconCollapsed'].value}"
+
leftIconExpanded="#{richCollapsiblePanelBean.attributes['leftIconExpanded'].value}"
limitRender="#{richCollapsiblePanelBean.attributes['limitRender'].value}"
onbeforedomupdate="#{richCollapsiblePanelBean.attributes['onbeforedomupdate'].value}"
onbeforeswitch="#{richCollapsiblePanelBean.attributes['onbeforeswitch'].value}"
+
onbegin="#{richCollapsiblePanelBean.attributes['onbegin'].value}"
onclick="#{richCollapsiblePanelBean.attributes['onclick'].value}"
oncomplete="#{richCollapsiblePanelBean.attributes['oncomplete'].value}"
ondblclick="#{richCollapsiblePanelBean.attributes['ondblclick'].value}"
@@ -68,6 +71,8 @@
onswitch="#{richCollapsiblePanelBean.attributes['onswitch'].value}"
render="#{richCollapsiblePanelBean.attributes['render'].value}"
rendered="#{richCollapsiblePanelBean.attributes['rendered'].value}"
+
rightIconCollapsed="#{richCollapsiblePanelBean.attributes['rightIconCollapsed'].value}"
+
rightIconExpanded="#{richCollapsiblePanelBean.attributes['rightIconExpanded'].value}"
status="#{richCollapsiblePanelBean.attributes['status'].value}"
style="#{richCollapsiblePanelBean.attributes['style'].value}"
styleClass="#{richCollapsiblePanelBean.attributes['styleClass'].value}"
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/list.xhtml 2011-01-27
13:16:30 UTC (rev 21275)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/list.xhtml 2011-01-27
13:18:22 UTC (rev 21276)
@@ -5,7 +5,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.
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/simple.xhtml 2011-01-27
13:16:30 UTC (rev 21275)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richCollapsiblePanel/simple.xhtml 2011-01-27
13:18:22 UTC (rev 21276)
@@ -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.
@@ -40,7 +40,7 @@
</ui:define>
<ui:define name="component">
-
+
<rich:collapsiblePanel id="collapsiblePanel"
bodyClass="#{richCollapsiblePanelBean.attributes['bodyClass'].value}"
bypassUpdates="#{richCollapsiblePanelBean.attributes['bypassUpdates'].value}"
@@ -53,9 +53,12 @@
headerControlClass="#{richCollapsiblePanelBean.attributes['headerControlClass'].value}"
immediate="#{richCollapsiblePanelBean.attributes['immediate'].value}"
lang="#{richCollapsiblePanelBean.attributes['lang'].value}"
+
leftIconCollapsed="#{richCollapsiblePanelBean.attributes['leftIconCollapsed'].value}"
+
leftIconExpanded="#{richCollapsiblePanelBean.attributes['leftIconExpanded'].value}"
limitRender="#{richCollapsiblePanelBean.attributes['limitRender'].value}"
onbeforedomupdate="#{richCollapsiblePanelBean.attributes['onbeforedomupdate'].value}"
onbeforeswitch="#{richCollapsiblePanelBean.attributes['onbeforeswitch'].value}"
+
onbegin="#{richCollapsiblePanelBean.attributes['onbegin'].value}"
onclick="#{richCollapsiblePanelBean.attributes['onclick'].value}"
oncomplete="#{richCollapsiblePanelBean.attributes['oncomplete'].value}"
ondblclick="#{richCollapsiblePanelBean.attributes['ondblclick'].value}"
@@ -67,6 +70,8 @@
onswitch="#{richCollapsiblePanelBean.attributes['onswitch'].value}"
render="#{richCollapsiblePanelBean.attributes['render'].value}"
rendered="#{richCollapsiblePanelBean.attributes['rendered'].value}"
+
rightIconCollapsed="#{richCollapsiblePanelBean.attributes['rightIconCollapsed'].value}"
+
rightIconExpanded="#{richCollapsiblePanelBean.attributes['rightIconExpanded'].value}"
status="#{richCollapsiblePanelBean.attributes['status'].value}"
style="#{richCollapsiblePanelBean.attributes['style'].value}"
styleClass="#{richCollapsiblePanelBean.attributes['styleClass'].value}"
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2011-01-27
13:16:30 UTC (rev 21275)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2011-01-27
13:18:22 UTC (rev 21276)
@@ -68,12 +68,14 @@
public abstract class AbstractMetamerTest extends AbstractTestCase {
protected JQueryLocator time = jq("span[id$=requestTime]");
+ protected JQueryLocator renderChecker = jq("span[id$=renderChecker]");
+ protected JQueryLocator statusChecker =
jq("span[id$=statusCheckerOutput]");
protected TextRetriever retrieveRequestTime = retrieveText.locator(time);
protected Retriever<String> retrieveWindowData = new
ScriptEvaluationRetriever().script(js("window.data"));
protected TextRetriever retrieveRenderChecker =
retrieveText.locator(jq("#renderChecker"));
protected TextRetriever retrieveStatusChecker =
retrieveText.locator(jq("#statusCheckerOutput"));
protected PhaseInfo phaseInfo = new PhaseInfo();
-
+
/**
* timeout in miliseconds
*/
@@ -242,7 +244,7 @@
assertTrue(selenium.isElementPresent(element));
assertFalse(selenium.isElementPresent(elementWhichHasntThatClass));
}
-
+
public void testRequestEventsBefore(String... events) {
for (String event : events) {
selenium.type(pjq(format("input[type=text][id$=on{0}Input]",
event)), format("metamerEvents += \"{0} \"", event));
@@ -253,7 +255,7 @@
retrieveRequestTime.initializeValue();
}
-
+
public void testRequestEventsAfter(String... events) {
waitGui.failWith("Page was not
updated").waitForChange(retrieveRequestTime);
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java 2011-01-27
13:16:30 UTC (rev 21275)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCollapsiblePanel/TestRichCollapsiblePanel.java 2011-01-27
13:18:22 UTC (rev 21276)
@@ -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.
*
@@ -24,15 +24,22 @@
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.assertTrue;
+import static org.testng.Assert.fail;
import java.net.URL;
import javax.faces.event.PhaseId;
+import org.jboss.test.selenium.css.CssProperty;
+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.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
@@ -47,11 +54,13 @@
public class TestRichCollapsiblePanel extends AbstractMetamerTest {
private JQueryLocator panel = pjq("div[id$=collapsiblePanel]");
- private JQueryLocator header = pjq("div[id$=collapsiblePanel:header]
div.rf-cp-lbl-exp");
+ private JQueryLocator header = pjq("div[id$=collapsiblePanel:header]");
private JQueryLocator headerExp = pjq("div[id$=collapsiblePanel:header]
div.rf-cp-lbl-exp");
private JQueryLocator headerColps = pjq("div[id$=collapsiblePanel:header]
div.rf-cp-lbl-colps");
private JQueryLocator content = pjq("div[id$=collapsiblePanel:content]");
-
+ private JQueryLocator leftIcon = pjq("td.rf-cp-ico");
+ private JQueryLocator rightIcon = pjq("td.rf-cp-exp-ico");
+
@Override
public URL getTestUrl() {
return buildUrl(contextPath,
"faces/components/richCollapsiblePanel/simple.xhtml");
@@ -66,70 +75,75 @@
}
@Test
- public void testSwitchTypeNull() {
- // click to collapse
- String timeValue = selenium.getText(time);
- guardXhr(selenium).click(header);
- waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+ public void testBodyClass() {
+ testStyleClass(content, "bodyClass");
+ }
- verifyAfterClick();
+ @Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10054")
+ public void testBypassUpdates() {
+
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
+ selenium.waitForPageToLoad();
- // click to expand
- timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
guardXhr(selenium).click(header);
- waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
- verifyBeforeClick();
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertListener(PhaseId.APPLY_REQUEST_VALUES, "panel
collapsed");
}
@Test
- public void testSwitchTypeAjax() {
- selenium.click(pjq("input[name$=switchTypeInput][value=ajax]"));
+ @IssueTracking("https://issues.jboss.org/browse/RF-10061")
+ public void testData() {
+ selenium.type(pjq("input[type=text][id$=dataInput]"), "RichFaces
4");
selenium.waitForPageToLoad();
- testSwitchTypeNull();
- }
-
- @Test
- public void testSwitchTypeClient() {
- selenium.click(pjq("input[name$=switchTypeInput][value=client]"));
+ selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data
= event.data");
selenium.waitForPageToLoad();
- // click to collapse
- guardNoRequest(selenium).click(header);
- verifyAfterClick();
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(header);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
- // click to expand
- guardNoRequest(selenium).click(header);
- verifyBeforeClick();
+ String data = selenium.getEval(new JavaScript("window.data"));
+ assertEquals(data, "RichFaces 4", "Data sent with ajax
request");
}
@Test
- public void testSwitchTypeServer() {
- selenium.click(pjq("input[name$=switchTypeInput][value=server]"));
+ public void testDir() {
+ testDir(panel);
+ }
+
+ @Test
+ public void testExecute() {
+ selenium.type(pjq("input[type=text][id$=executeInput]"), "input
executeChecker");
selenium.waitForPageToLoad();
- // click to collapse
- guardHttp(selenium).click(header);
- verifyAfterClick();
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(header);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
- // click to expand
- guardHttp(selenium).click(header);
- verifyBeforeClick();
+ 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
- @IssueTracking("https://issues.jboss.org/browse/RF-10054")
- public void testBypassUpdates() {
-
selenium.click(pjq("input[type=radio][name$=bypassUpdatesInput][value=true]"));
+ @IssueTracking("https://issues.jboss.org/browse/RF-10312")
+ public void testExpanded() {
+ verifyBeforeClick();
+
+
selenium.click(pjq("input[type=radio][name$=expandedInput][value=false]"));
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
- guardXhr(selenium).click(header);
- waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
-
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
- PhaseId.RENDER_RESPONSE);
+ verifyAfterClick();
}
@Test
@@ -137,28 +151,71 @@
selenium.type(pjq("input[type=text][id$=headerInput]"), "new
header");
selenium.waitForPageToLoad();
- assertEquals(selenium.getText(header), "new header", "Header of
the panel did not change.");
+ assertEquals(selenium.getText(headerExp), "new header", "Header of
the panel did not change.");
selenium.type(pjq("input[type=text][id$=headerInput]"),
"ľščťťžžôúňď ацущьмщфзщйцу");
selenium.waitForPageToLoad();
- assertEquals(selenium.getText(header), "ľščťťžžôúňď ацущьмщфзщйцу",
"Header of the panel did not change.");
+ assertEquals(selenium.getText(headerExp), "ľščťťžžôúňď ацущьмщфзщйцу",
"Header of the panel did not change.");
}
@Test
+ public void testHeaderClass() {
+ testStyleClass(header, "headerClass");
+ }
+
+ @Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-10331")
+ public void testHeaderControlClass() {
+ testStyleClass(header.getDescendant(jq("td.rf-cp-ico")),
"headerControlClass");
+ }
+
+ @Test
@IssueTracking("https://issues.jboss.org/browse/RF-10054")
public void testImmediate() {
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
guardXhr(selenium).click(header);
- waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertListener(PhaseId.APPLY_REQUEST_VALUES, "panel
collapsed");
}
@Test
+ public void testLang() {
+ testLang(panel);
+ }
+
+ @Test
+ public void testLeftIconCollapsed() {
+ JQueryLocator icon =
leftIcon.getDescendant(jq("div.rf-cp-ico-colps"));
+ JQueryLocator input = pjq("select[id$=leftIconCollapsedInput]");
+ JQueryLocator image = leftIcon.getChild(jq("img:nth-child(1)"));
+
+ // icon=null
+ assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-up-hdr"),
"Div should have set class rf-ico-chevron-up-hdr.");
+ assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("ChevronUp.png"), "Icon should
contain a chevron up.");
+
+ verifyStandardIcons(input, icon, image);
+ }
+
+ @Test
+ public void testLeftIconExpanded() {
+ JQueryLocator icon = leftIcon.getDescendant(jq("div.rf-cp-ico-exp"));
+ JQueryLocator input = pjq("select[id$=leftIconExpandedInput]");
+ JQueryLocator image = leftIcon.getChild(jq("img:nth-child(2)"));
+
+ // icon=null
+ assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-down-hdr"),
"Div should have set class rf-ico-chevron-down-hdr.");
+ assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("ChevronDown.png"), "Icon should
contain a chevron down.");
+
+ verifyStandardIcons(input, icon, image);
+ }
+
+ @Test
@IssueTracking("https://issues.jboss.org/browse/RF-9535")
public void testLimitRender() {
selenium.type(pjq("input[type=text][id$=renderInput]"),
"@this");
@@ -167,16 +224,103 @@
selenium.click(pjq("input[type=radio][name$=limitRenderInput][value=true]"));
selenium.waitForPageToLoad();
- String timeValue = selenium.getText(time);
+ String reqTime = selenium.getText(time);
guardXhr(selenium).click(header);
waitGui.failWith("Panel should be
collapsed.").until(isDisplayed.locator(headerColps));
String newTime = selenium.getText(time);
- assertTrue(newTime.equals(timeValue), "Panel with ajaxRendered=true should
not be rerendered (old and new time should be same).");
+ assertTrue(newTime.equals(reqTime), "Panel with ajaxRendered=true should not
be rerendered (old and new time should be same).");
}
@Test
+ public void testAjaxEvents() {
+ 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);
+ guardXhr(selenium).click(header);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ String[] events = selenium.getEval(new
JavaScript("window.metamerEvents")).split(" ");
+
+ assertEquals(events.length, 3, "3 events should be fired.");
+ 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 testOnbeforeswitchOnswitch() {
+ selenium.type(pjq("input[type=text][id$=onbeforeswitchInput]"),
"metamerEvents += \"beforeswitch \"");
+ selenium.waitForPageToLoad();
+ selenium.type(pjq("input[type=text][id$=onswitchInput]"),
"metamerEvents += \"switch \"");
+ selenium.waitForPageToLoad();
+
+ selenium.getEval(new JavaScript("window.metamerEvents =
\"\";"));
+
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(header);
+
+ String[] events = selenium.getEval(new
JavaScript("window.metamerEvents")).split(" ");
+
+ assertEquals(events.length, 2, "2 events should be fired.");
+ assertEquals(events[0], "beforeswitch", "Attribute onbeforeswitch
doesn't work");
+ assertEquals(events[1], "switch", "Attribute onswitch doesn't
work");
+ }
+
+ @Test
+ public void testOnclick() {
+ testFireEvent(Event.CLICK, panel);
+ }
+
+ @Test
+ public void testOndblclick() {
+ testFireEvent(Event.DBLCLICK, panel);
+ }
+
+ @Test
+ public void testOnmousedown() {
+ testFireEvent(Event.MOUSEDOWN, panel);
+ }
+
+ @Test
+ public void testOnmousemove() {
+ testFireEvent(Event.MOUSEMOVE, panel);
+ }
+
+ @Test
+ public void testOnmouseout() {
+ testFireEvent(Event.MOUSEOUT, panel);
+ }
+
+ @Test
+ public void testOnmouseover() {
+ testFireEvent(Event.MOUSEOVER, panel);
+ }
+
+ @Test
+ public void testOnmouseup() {
+ testFireEvent(Event.MOUSEUP, panel);
+ }
+
+ @Test
+ public void testRender() {
+ selenium.type(pjq("input[type=text][id$=renderInput]"),
"renderChecker");
+ selenium.waitForPageToLoad();
+
+ String renderCheckerTime = selenium.getText(renderChecker);
+ guardXhr(selenium).click(header);
+ waitGui.failWith("Attribute render doesn't
work").waitForChange(renderCheckerTime, retrieveText.locator(renderChecker));
+ }
+
+ @Test
public void testRendered() {
selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
selenium.waitForPageToLoad();
@@ -184,6 +328,121 @@
assertFalse(selenium.isElementPresent(panel), "Panel should not be rendered
when rendered=false.");
}
+ @Test
+ public void testRightIconCollapsed() {
+ JQueryLocator icon =
rightIcon.getDescendant(jq("div.rf-cp-ico-colps"));
+ JQueryLocator input = pjq("select[id$=rightIconCollapsedInput]");
+ JQueryLocator image = rightIcon.getChild(jq("img:nth-child(1)"));
+
+ // icon=null
+ assertFalse(selenium.isElementPresent(rightIcon), "Right icon should not be
present on the page.");
+
+ verifyStandardIcons(input, icon, image);
+ }
+
+ @Test
+ public void testRightIconExpanded() {
+ JQueryLocator icon = rightIcon.getDescendant(jq("div.rf-cp-ico-exp"));
+ JQueryLocator input = pjq("select[id$=rightIconExpandedInput]");
+ JQueryLocator image = rightIcon.getChild(jq("img:nth-child(1)"));
+
+ // icon=null
+ assertFalse(selenium.isElementPresent(rightIcon), "Right icon should not be
present on the page.");
+
+ verifyStandardIcons(input, icon, image);
+ }
+
+ @Test
+ public void testStatus() {
+ selenium.type(pjq("input[type=text][id$=statusInput]"),
"statusChecker");
+ selenium.waitForPageToLoad();
+
+ String statusCheckerTime = selenium.getText(statusChecker);
+ guardXhr(selenium).click(header);
+ waitGui.failWith("Attribute status doesn't
work").waitForChange(statusCheckerTime, retrieveText.locator(statusChecker));
+ }
+
+ @Test
+ public void testStyle() {
+ testStyle(panel, "style");
+ }
+
+ @Test
+ public void testStyleClass() {
+ testStyleClass(panel, "styleClass");
+ }
+
+ @Test
+ public void testSwitchTypeNull() {
+ // click to collapse
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(header);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ verifyAfterClick();
+
+ // click to expand
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).click(header);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+
+ verifyBeforeClick();
+ }
+
+ @Test
+ public void testSwitchTypeAjax() {
+ selenium.click(pjq("input[name$=switchTypeInput][value=ajax]"));
+ selenium.waitForPageToLoad();
+
+ testSwitchTypeNull();
+ }
+
+ @Test
+ public void testSwitchTypeClient() {
+ selenium.click(pjq("input[name$=switchTypeInput][value=client]"));
+ selenium.waitForPageToLoad();
+
+ // click to collapse
+ guardNoRequest(selenium).click(header);
+ verifyAfterClick();
+
+ // click to expand
+ guardNoRequest(selenium).click(header);
+ verifyBeforeClick();
+ }
+
+ @Test
+ public void testSwitchTypeServer() {
+ selenium.click(pjq("input[name$=switchTypeInput][value=server]"));
+ selenium.waitForPageToLoad();
+
+ // click to collapse
+ guardHttp(selenium).click(header);
+ verifyAfterClick();
+
+ // click to expand
+ guardHttp(selenium).click(header);
+ verifyBeforeClick();
+ }
+
+ @Test
+ public void testTitle() {
+ testTitle(panel);
+ }
+
+ @Test
+ public void testToggleListener() {
+ String reqTime = selenium.getText(time);
+ guardXhr(selenium).click(header);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+ phaseInfo.assertListener(PhaseId.INVOKE_APPLICATION, "panel
collapsed");
+
+ reqTime = selenium.getText(time);
+ guardXhr(selenium).click(header);
+ waitGui.failWith("Page was not updated").waitForChange(reqTime,
retrieveText.locator(time));
+ phaseInfo.assertListener(PhaseId.INVOKE_APPLICATION, "panel
expanded");
+ }
+
private void verifyBeforeClick() {
boolean displayed = selenium.isDisplayed(panel);
assertTrue(displayed, "Collapsible panel is not present on the
page.");
@@ -197,7 +456,7 @@
displayed = selenium.isDisplayed(content);
assertTrue(displayed, "Panel's content should be visible.");
- String text = selenium.getText(header);
+ String text = selenium.getText(headerExp);
assertEquals(text, "collapsible panel header", "Header of the
panel.");
text = selenium.getText(content);
@@ -219,7 +478,61 @@
assertFalse(displayed, "Panel's content should not be
visible.");
}
- String text = selenium.getText(header);
+ String text = selenium.getText(headerColps);
assertEquals(text, "collapsible panel header", "Header of the
panel.");
}
+
+ private void verifyStandardIcons(JQueryLocator input, JQueryLocator icon,
JQueryLocator image) {
+ selenium.select(input, optionLabel("chevronDown"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-down-hdr"),
"Div should have set class rf-ico-chevron-down-hdr.");
+ assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("ChevronDown.png"), "Icon should
contain a chevron down.");
+
+ selenium.select(input, optionLabel("chevronUp"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.belongsClass(icon, "rf-ico-chevron-up-hdr"),
"Div should have set class rf-ico-chevron-up-hdr.");
+ assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("ChevronUp.png"), "Icon should
contain a chevron up.");
+
+ selenium.select(input, optionLabel("disc"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.belongsClass(icon, "rf-ico-disc-hdr"), "Div
should have set class rf-ico-disc-hdr.");
+ assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("Disc.png"), "Icon should contain a
disc.");
+
+ selenium.select(input, optionLabel("grid"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.belongsClass(icon, "rf-ico-grid-hdr"), "Div
should have set class rf-ico-grid-hdr.");
+ assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("Grid.png"), "Icon should contain a
grid.");
+
+ selenium.select(input, optionLabel("triangle"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-hdr"),
"Div should have set class rf-ico-triangle-hdr.");
+ assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("Triangle.png"), "Icon should
contain a triangle.");
+
+ selenium.select(input, optionLabel("triangleDown"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-down-hdr"),
"Div should have set class rf-ico-triangle-down-hdr.");
+ assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("TriangleDown.png"), "Icon should
contain a triangle down.");
+
+ selenium.select(input, optionLabel("triangleUp"));
+ selenium.waitForPageToLoad();
+ assertTrue(selenium.belongsClass(icon, "rf-ico-triangle-up-hdr"),
"Div should have set class rf-ico-triangle-up-hdr.");
+ assertTrue(selenium.getStyle(icon,
CssProperty.BACKGROUND_IMAGE).contains("TriangleUp.png"), "Icon should
contain a triangle up.");
+
+ selenium.select(input, optionLabel("none"));
+ selenium.waitForPageToLoad();
+ assertFalse(selenium.isElementPresent(icon), "Icon should not be present
when icon=none.");
+
+ selenium.select(input, optionLabel("star"));
+ selenium.waitForPageToLoad();
+ assertFalse(selenium.isElementPresent(icon), "Icon's div should not be
present when icon=star.");
+ waitFor(5000);
+ assertTrue(selenium.isElementPresent(image), "Icon's image should be
rendered.");
+
assertTrue(selenium.getAttribute(image.getAttribute(Attribute.SRC)).contains("star.png"),
"Icon's src attribute should contain star.png.");
+
+ selenium.select(input, optionLabel("nonexisting"));
+ selenium.waitForPageToLoad();
+ assertFalse(selenium.isElementPresent(icon), "Icon's div should not be
present when icon=nonexisting.");
+ assertTrue(selenium.isElementPresent(image), "Icon's image should be
rendered.");
+
assertTrue(selenium.getAttribute(image.getAttribute(Attribute.SRC)).contains("nonexisting"),
"Icon's src attribute should contain nonexisting.");
+ }
}