Author: jjamrich
Date: 2011-11-21 17:51:20 -0500 (Mon, 21 Nov 2011)
New Revision: 22964
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAutocomplete/TestAutocompleteFormatting.java
Log:
RFPL-1231: Add tests for @layout in autocomplete
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAutocomplete/TestAutocompleteFormatting.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAutocomplete/TestAutocompleteFormatting.java 2011-11-21
09:45:00 UTC (rev 22963)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAutocomplete/TestAutocompleteFormatting.java 2011-11-21
22:51:20 UTC (rev 22964)
@@ -31,7 +31,9 @@
import java.util.LinkedList;
import java.util.List;
+import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.utils.URLUtils;
+import org.jboss.test.selenium.waiting.selenium.SeleniumCondition;
import org.richfaces.tests.metamer.bean.Model;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.annotations.Inject;
@@ -94,6 +96,36 @@
assertTrue(autocomplete.getInputText().toLowerCase().startsWith(getExpectedStateForPrefix().toLowerCase()));
}
+ @Test
+ public void testLayout() {
+
+ JQueryLocator suggestionsGridDiv = new JQueryLocator("div.rf-au-lst-scrl
> div[id$=autocompleteItems] > div:contains({0})");
+ JQueryLocator suggestionsList = new JQueryLocator("div.rf-au-lst-scrl >
ul[id$=autocompleteItems] > li:contains({0})");
+ JQueryLocator suggestionsTable = new JQueryLocator("div.rf-au-lst-scrl >
table[id$=autocompleteItems] tr>td:contains({0})");
+
+ verifyLayout("div", suggestionsGridDiv);
+
+ verifyLayout("grid", suggestionsGridDiv);
+
+ verifyLayout("list", suggestionsList);
+
+ verifyLayout("table", suggestionsTable);
+
+ }
+
+ private void verifyLayout(String layout, JQueryLocator suggestionLocatorFormat) {
+
+ autocompleteAttributes.set(AutocompleteAttributes.layout, layout);
+
+ autocomplete.typeKeys("Co");
+
+
assertTrue(selenium.isElementPresent(suggestionLocatorFormat.format("Colorado")));
+
assertTrue(selenium.isElementPresent(suggestionLocatorFormat.format("[Denver]")));
+
+
assertTrue(selenium.isElementPresent(suggestionLocatorFormat.format("Connecticut")));
+
assertTrue(selenium.isElementPresent(suggestionLocatorFormat.format("[Hartford]")));
+ }
+
public void typePrefix(String wholeInput) {
partialInput = new StringBuilder(autocomplete.getInputText());
@@ -173,3 +205,4 @@
this.selectFirst = selectFirst;
}
}
+
Show replies by date