Author: ppitonak(a)redhat.com
Date: 2012-01-03 04:43:39 -0500 (Tue, 03 Jan 2012)
New Revision: 23119
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richToolbar/TestRichToolbar.java
Log:
tests for rich:toolbar's attributes height and widht rewritten because of RF-11830
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richToolbar/TestRichToolbar.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richToolbar/TestRichToolbar.java 2011-12-20
13:42:18 UTC (rev 23118)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richToolbar/TestRichToolbar.java 2012-01-03
09:43:39 UTC (rev 23119)
@@ -26,7 +26,6 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.richfaces.tests.metamer.ftest.BasicAttributes.itemClass;
import static org.richfaces.tests.metamer.ftest.BasicAttributes.itemStyle;
-import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
@@ -51,10 +50,10 @@
private JQueryLocator toolbar = pjq("table[id$=toolbar]");
private JQueryLocator separator = pjq("td.rf-tb-sep");
- private JQueryLocator[] items = {pjq("td[id$=createDocument_itm]"),
pjq("td[id$=createFolder_itm]"),
+ private JQueryLocator[] items = { pjq("td[id$=createDocument_itm]"),
pjq("td[id$=createFolder_itm]"),
pjq("td[id$=copy_itm]"), pjq("td[id$=save_itm]"),
pjq("td[id$=saveAs_itm]"), pjq("td[id$=saveAll_itm]"),
- pjq("td[id$=input_itm]"), pjq("td[id$=button_itm]")};
- private String[] separators = {"disc", "grid", "line",
"square"};
+ pjq("td[id$=input_itm]"), pjq("td[id$=button_itm]") };
+ private String[] separators = { "disc", "grid", "line",
"square" };
@Inject
@Use(empty = true)
private JQueryLocator item;
@@ -83,10 +82,14 @@
@Test
public void testHeight() {
- selenium.type(pjq("input[id$=heightInput]"), "");
+ AttributeLocator<?> attr = toolbar.getAttribute(Attribute.STYLE);
+ assertTrue(selenium.isAttributePresent(attr), "Attribute style should be
present.");
+ assertTrue(selenium.getAttribute(attr).contains("height: 28px"),
"Height in attribute style should be 28px");
+
+ selenium.type(pjq("input[id$=heightInput]"), "50px");
selenium.waitForPageToLoad();
- testHtmlAttribute(toolbar, "height", "50px");
+ assertTrue(selenium.getAttribute(attr).contains("height: 50px"),
"Attribute style should have height 50px.");
}
@Test
@@ -127,7 +130,7 @@
selenium.waitForPageToLoad();
JQueryLocator separatorImg = separator.getDescendant(jq("> img"));
- AttributeLocator attr = separatorImg.getAttribute(Attribute.SRC);
+ AttributeLocator<?> attr = separatorImg.getAttribute(Attribute.SRC);
assertTrue(selenium.isElementPresent(separator), "Item separator should be
present on the page.");
assertTrue(selenium.isElementPresent(separatorImg), "Item separator does not
work correctly.");
@@ -142,7 +145,7 @@
selenium.waitForPageToLoad();
JQueryLocator separatorImg = separator.getDescendant(jq("> img"));
- AttributeLocator attr = separatorImg.getAttribute(Attribute.SRC);
+ AttributeLocator<?> attr = separatorImg.getAttribute(Attribute.SRC);
assertTrue(selenium.isElementPresent(separator), "Item separator should be
present on the page.");
assertTrue(selenium.isElementPresent(separatorImg), "Item separator does not
work correctly.");
@@ -230,21 +233,22 @@
public void testStyle() {
super.testStyle(toolbar);
}
-
+
@Test
public void testStyleClass() {
super.testStyleClass(toolbar);
}
-
+
@Test
public void testWidth() {
- AttributeLocator attr = toolbar.getAttribute(Attribute.WIDTH);
- assertTrue(selenium.isAttributePresent(attr), "Attribute width should be
present.");
- assertEquals(selenium.getAttribute(attr), "100%", "Attribute width
when it is not set.");
+ AttributeLocator<?> attr = toolbar.getAttribute(Attribute.STYLE);
+ assertTrue(selenium.isAttributePresent(attr), "Attribute style should be
present.");
+ assertTrue(selenium.getAttribute(attr).contains("width: 100%"),
+ "Attribute style should have 100% width when it is not set.");
selenium.type(pjq("input[id$=widthInput]"), "500px");
selenium.waitForPageToLoad();
- assertTrue(selenium.getAttribute(attr).contains("500px"),
"Attribute width should contain \"500px\".");
+ assertTrue(selenium.getAttribute(attr).contains("width: 500px"),
"Attribute style should have width 500px.");
}
}