Author: ppitonak(a)redhat.com
Date: 2011-11-18 05:44:35 -0500 (Fri, 18 Nov 2011)
New Revision: 22956
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/OrderingList.java
Log:
tests fixed
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/OrderingList.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/OrderingList.java 2011-11-17
22:40:41 UTC (rev 22955)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/OrderingList.java 2011-11-18
10:44:35 UTC (rev 22956)
@@ -36,9 +36,9 @@
*/
public class OrderingList implements Model {
- private final JQueryLocator buttonBottom =
jq("button.rf-ord-down-bottom");
- private final JQueryLocator buttonDown = jq("button.rf-ord-down");
- private final JQueryLocator buttonTop = jq("button.rf-ord-up-top");
+ private final JQueryLocator buttonBottom = jq("button.rf-ord-dn-bt");
+ private final JQueryLocator buttonDown = jq("button.rf-ord-dn");
+ private final JQueryLocator buttonTop = jq("button.rf-ord-up-tp");
private final JQueryLocator buttonUp = jq("button.rf-ord-up");
private final JQueryLocator header = pjq("thead.rf-ord-lst-header >
tr");
private final JQueryLocator item = pjq("tbody[id$=orderingListItems] >
tr.rf-ord-opt");
@@ -50,65 +50,66 @@
private int numberOfItems = -1;
private int numberOfColumns = -1;
private final AjaxSelenium selenium;
-
+
public OrderingList() {
this(AjaxSeleniumProxy.getInstance());
}
-
+
public OrderingList(AjaxSelenium selenium) {
Validate.notNull(selenium);
this.selenium = selenium;
}
-
+
public JQueryLocator getHeader() {
return header;
}
-
+
public int getIndexOfSelectedItem() {
if (!isItemSelected()) {
throw new IllegalStateException("There is no selected item.");
}
return getNumberOfItems() - selenium.getCount(jq(itemSelected.getRawLocator() +
" ~ tr")) - 1;
}
-
+
public JQueryLocator getItem(int index) {
if (index < 0 || index >= getNumberOfItems()) {
throw new IndexOutOfBoundsException("The index <" + index +
"> is out of the range [0, "
+ getNumberOfItems() + "].");
}
return jq(item.getRawLocator() + ":eq(" + index + ")");
- }
-
+ }
+
public JQueryLocator getItemColumn(int indexItem, int indexColumn) {
if (indexColumn < 0 || indexColumn >= getNumberOfColumns()) {
- throw new IndexOutOfBoundsException("The index of column <" +
indexColumn + "> is out of the range [0, " + getNumberOfColumns() +
"]");
- }
+ throw new IndexOutOfBoundsException("The index of column <" +
indexColumn + "> is out of the range [0, "
+ + getNumberOfColumns() + "]");
+ }
return jq(getItem(indexItem).getRawLocator() + " > .rf-ord-cell:eq("
+ indexColumn + ")");
}
-
+
public String getItemColumnValue(int indexItem, int indexColumn) {
return selenium.getText(getItemColumn(indexItem, indexColumn));
}
-
+
public JQueryLocator getList() {
return list;
}
-
+
public JQueryLocator getListArea() {
return listArea;
}
-
+
public JQueryLocator getLocator() {
return orderingList;
}
-
+
public int getNumberOfColumns() {
if (numberOfColumns == -1) {
numberOfColumns = selenium.getCount(jq(getItem(0).getRawLocator() + "
> .rf-ord-cell"));
}
return numberOfColumns;
}
-
+
public int getNumberOfItems() {
if (numberOfItems == -1) {
numberOfItems = selenium.getCount(item);
@@ -118,82 +119,83 @@
public JQueryLocator getScrollableArea() {
return scrollableArea;
- }
-
+ }
+
public boolean isButtonBottomEnabled() {
return isButtonEnabled(buttonBottom);
}
public boolean isButtonDownEnabled() {
return isButtonEnabled(buttonDown);
- }
-
+ }
+
public boolean isButtonTopEnabled() {
return isButtonEnabled(buttonTop);
}
-
+
public boolean isButtonUpEnabled() {
return isButtonEnabled(buttonUp);
- }
+ }
public boolean isButtonBottomPresent() {
return selenium.isElementPresent(buttonBottom);
}
-
+
public boolean isButtonDownPresent() {
return selenium.isElementPresent(buttonDown);
- }
-
+ }
+
public boolean isButtonTopPresent() {
return selenium.isElementPresent(buttonTop);
- }
+ }
public boolean isButtonUpPresent() {
return selenium.isElementPresent(buttonUp);
- }
-
+ }
+
public boolean isItemSelected() {
return selenium.isElementPresent(itemSelected);
}
-
+
public boolean isOrderingListPresent() {
return selenium.isElementPresent(orderingList);
}
-
+
public void moveBottom() {
move(buttonBottom);
}
-
+
public void moveDown() {
move(buttonDown);
}
-
+
public void moveTop() {
move(buttonTop);
- }
-
+ }
+
public void moveUp() {
move(buttonUp);
- }
-
+ }
+
public void selectItem(int index) {
selenium.mouseDown(getItem(index));
selenium.mouseUp(getItem(index));
selenium.click(getItem(index));
- }
-
+ }
+
private boolean isButtonEnabled(JQueryLocator button) {
return !selenium.isElementPresent(jq(button.getRawLocator() +
".rf-ord-btn-dis"));
}
-
+
private void move(JQueryLocator button) {
if (!selenium.isElementPresent(itemSelected)) {
throw new IllegalStateException("No item is selected, so the moving
action can't be proceeded.");
- }
+ }
if (!isButtonEnabled(button)) {
- throw new IllegalStateException("The moving action can't be
proceeded because the moving button is disabled.");
+ throw new IllegalStateException(
+ "The moving action can't be proceeded because the moving button
is disabled.");
}
selenium.click(button);
}
-
+
}
Show replies by date