Author: dsvyatobatsko
Date: 2008-10-09 07:57:25 -0400 (Thu, 09 Oct 2008)
New Revision: 10703
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenu/panelMenuTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuTest.java
Log:
PanelMenu: test style and classes, standard HTML attributes are output to client
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenu/panelMenuTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-10-09
10:06:22 UTC (rev 10702)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-10-09
11:57:25 UTC (rev 10703)
@@ -872,6 +872,17 @@
* @param expectedExpression - expected style attribute
*/
public void assertStyleAttribute(String elementId, String expectedExpression) {
+ assertStyleAttribute(elementId, expectedExpression, null);
+ }
+
+ /**
+ * Method to assert element style attribute with expected
+ * @param elementId - tested element id
+ * @param expectedExpression - expected style attribute
+ * @param message - Message will be inserted in the log after test failure
+ */
+
+ public void assertStyleAttribute(String elementId, String expectedExpression, String
message) {
String styleAttribute = null;
try {
styleAttribute = selenium.getAttribute("//*[@id='" + elementId
+ "']/@style");
@@ -880,11 +891,16 @@
}
if (null == styleAttribute ||
!styleAttribute.toLowerCase().contains(expectedExpression.toLowerCase())) {
- Assert.fail("Element '" + elementId + "' with style
'" + styleAttribute + "' doesn't contain '"
- + expectedExpression + "'");
+ String failureMsg = "Element '" + elementId + "' with
style '" + styleAttribute + "' doesn't contain '"
+ + expectedExpression + "'";
+ if (null != message && !"".equals(message.trim())) {
+ failureMsg = message + ": " + failureMsg;
+ }
+ Assert.fail(failureMsg);
}
}
+
/**
* Asserts that expected columns count equals actual one.
* @param i the expected columns count
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuTest.java 2008-10-09
10:06:22 UTC (rev 10702)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuTest.java 2008-10-09
11:57:25 UTC (rev 10703)
@@ -281,6 +281,29 @@
AssertNotPresent(getParentId() + "_form3:pMenu_selected");
}
+ @Test
+ public void testStyleAndClassesStandardHTMLAttributesAreOutputToClient(Template
template) {
+ renderPage(template, RESET_METHOD_NAME);
+
+ writeStatus("Check style and classes, standard HTML attributes are output to
client");
+
+ String menuId = getParentId() + "_form3:pMenu_selected";
+ assertStyleAttribute(menuId, "font-size: 13px", "Style attribute
was not output to client");
+ assertClassNames(menuId, new String[] { "noclass" }, "Class
attribute was not output to client", true);
+
+ String menuTopGroupId = "tablehide" + getParentId() +
"_form3:pGroup1_selected";
+ assertStyleAttribute(menuTopGroupId, "font-size: 14px",
"topGroupStyle attribute was not output to client");
+ assertClassNames(menuTopGroupId, new String[] { "topGroupClass" },
"topGroupClass attribute was not output to client", true);
+
+ String menuGroupId = "tablehide" + getParentId() +
"_form3:pGroup11_selected";
+ assertStyleAttribute(menuGroupId, "font-size: 15px", "groupStyle
attribute was not output to client");
+ assertClassNames(menuGroupId, new String[] { "groupClass" },
"groupClass attribute was not output to client", true);
+
+ String menuItemId = "tablehide" + getParentId() +
"_form3:pItem1_selected";
+ assertStyleAttribute(menuItemId, "font-size: 16px", "itemStyle
attribute was not output to client");
+ assertClassNames(menuItemId, new String[] { "itemClass" },
"itemClass attribute was not output to client", true);
+ }
+
/**
* Test an icon.
*
Show replies by date