Author: dsvyatobatsko
Date: 2009-01-23 11:33:36 -0500 (Fri, 23 Jan 2009)
New Revision: 12406
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/styleAndClasseStandardHTMLAttributesTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5791
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/styleAndClasseStandardHTMLAttributesTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/styleAndClasseStandardHTMLAttributesTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java 2009-01-23
16:11:13 UTC (rev 12405)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java 2009-01-23
16:33:36 UTC (rev 12406)
@@ -5,11 +5,19 @@
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
+import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
import org.testng.annotations.Test;
public class PanelMenuItemTest extends SeleniumTestBase {
+ private final static String LOOK_AND_FEEL_TEST_URL =
"pages/panelMenuItem/styleAndClasseStandardHTMLAttributesTest.xhtml";
+
+ private static final String FORM_ID = "form:";
+
+ private static final String CONTROL_FORM_ID = "control:";
+
+
private static Map<String, String> params = new HashMap<String,
String>();
static {
@@ -58,6 +66,63 @@
tester.testLimitToList();
}
+ @Test
+ public void testStandardHTMLAttributesAreOutputToClient(Template template) {
+ renderPage(LOOK_AND_FEEL_TEST_URL, template, null);
+
+ writeStatus("Check standard HTML attributes are output to client");
+
+ String parentId = getParentId();
+ String isDisabledId = parentId + CONTROL_FORM_ID + "isDisabled";
+ String disablingControlId = parentId + CONTROL_FORM_ID + "disable";
+ String menuItemId = "icon" + parentId + FORM_ID + "item";
+
+ check(isDisabledId, false);
+ clickCommandAndWait(disablingControlId);
+
+ writeStatus("Check standart HTML attributes");
+ assertEvents(menuItemId, SeleniumEvent.STANDARD_HTML_EVENTS);
+ }
+
+ @Test
+ public void testStylesAndStyleClassesAreOutputToClient(Template template) {
+ renderPage(LOOK_AND_FEEL_TEST_URL, template, null);
+
+ writeStatus("Check styles and classes are output to client");
+
+ String parentId = getParentId();
+ String isDisabledId = parentId + CONTROL_FORM_ID + "isDisabled";
+ String disablingControlId = parentId + CONTROL_FORM_ID + "disable";
+ String itemId = parentId + FORM_ID + "item";
+
+ writeStatus("Check enabled component at first");
+ check(isDisabledId, false);
+ clickCommandAndWait(disablingControlId);
+
+ String styleElementId = "tablehide" + parentId + FORM_ID +
"item";
+ assertStyleAttribute(styleElementId, "font-size: 16px", "Style
attribute was not output to client");
+ assertClassNames(styleElementId, new String[] { "noclass" },
"Class attribute was not output to client", true);
+
+ writeStatus("Check hoverClass/hoverStyle attributes");
+ selenium.mouseOver(styleElementId);
+ //assertStyleAttribute(styleElementId, "font-size: 14px",
"hoverStyle attribute was not output to client");
+ assertClassNames(styleElementId, new String[] { "hover-class" },
"hoverClass attribute was not output to client", true);
+ selenium.mouseOut(styleElementId);
+
+ writeStatus("Check iconClass/iconStyle attributes");
+ String iconTdXpath = "//*[@id='" + itemId +
"']/table/tbody/tr/td[1]";
+ //assertStyleAttribute(iconTdXpath, "font-size: 15px", "iconStyle
attribute was not output to client");
+ assertClassNames(iconTdXpath, new String[] { "icon-class" },
"iconClass attribute was not output to client", false);
+
+ writeStatus("Check disabled component");
+ check(isDisabledId, true);
+ clickCommandAndWait(disablingControlId);
+
+ writeStatus("Check disabledClass/disabledStyle attributes");
+ assertStyleAttribute(styleElementId, "font-size: 13px",
"disabledStyle attribute was not output to client");
+ assertClassNames(styleElementId, new String[] { "disabled-class" },
"disabledStyle attribute was not output to client", true);
+ }
+
@Override
public void sendAjax() {
clickAjaxCommandAndWait("icon" +
getAutoTester(this).getClientId("") + "item");
@@ -73,4 +138,8 @@
return null;
}
+ private void check(String id, boolean isChecked) {
+ runScript("document.getElementById('" + id +
"').checked=" + isChecked);
+ }
+
}