Author: lfryc(a)redhat.com
Date: 2011-01-22 17:47:42 -0500 (Sat, 22 Jan 2011)
New Revision: 21158
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/Autocomplete.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAutocomplete/TestAutocompleteByKeys.java
Log:
rich:autocomplete - fixed and removed issue tracking for RF-10254
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/Autocomplete.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/Autocomplete.java 2011-01-22
20:30:44 UTC (rev 21157)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/Autocomplete.java 2011-01-22
22:47:42 UTC (rev 21158)
@@ -21,11 +21,12 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.model;
+import static org.jboss.test.selenium.javascript.JQueryScript.jqObject;
+import static org.jboss.test.selenium.javascript.JQueryScript.jqScript;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.waiting.WaitFactory.elementPresent;
+import static org.jboss.test.selenium.waiting.WaitFactory.waitGui;
import static org.richfaces.tests.metamer.ftest.AbstractMetamerTest.pjq;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
-import static org.jboss.test.selenium.javascript.JQueryScript.jqScript;
-import static org.jboss.test.selenium.javascript.JQueryScript.jqObject;
-import static org.jboss.test.selenium.waiting.WaitFactory.*;
import java.awt.event.KeyEvent;
@@ -41,8 +42,7 @@
* @version $Revision$
*/
public class Autocomplete implements Model {
-
- private static String KEY_ENTER = "13";
+
private static String KEY_UP = "38";
private static String KEY_DOWN = "40";
@@ -120,7 +120,7 @@
}
public void pressEnter() {
- selenium.keyDown(input, KEY_ENTER);
+ selenium.keyDownNative(Integer.toString(KeyEvent.VK_ENTER));
}
public void pressLeft() {
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAutocomplete/TestAutocompleteByKeys.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAutocomplete/TestAutocompleteByKeys.java 2011-01-22
20:30:44 UTC (rev 21157)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richAutocomplete/TestAutocompleteByKeys.java 2011-01-22
22:47:42 UTC (rev 21158)
@@ -25,6 +25,7 @@
import static org.jboss.test.selenium.RequestTypeModelGuard.guardNoRequest;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
import java.net.URL;
import java.util.LinkedList;
@@ -57,11 +58,11 @@
@Inject
@Use(booleans = { true, false })
- Boolean autofill = false;
+ Boolean autofill;
@Inject
@Use(booleans = { true, false })
- Boolean selectFirst = false;
+ Boolean selectFirst;
List<Capital> capitals = Model.unmarshallCapitals();
@@ -86,6 +87,7 @@
assertCompletionVisible(true);
confirm();
assertCompletionVisible(false);
+
assertTrue(autocomplete.getInputText().toLowerCase().startsWith(getExpectedStateForPrefix().toLowerCase()));
}
@Test
@@ -141,7 +143,7 @@
}
public int getExpectedSelectedOptionIndex() {
- return (selectFirst) ? 0 : -1;
+ return (selectFirst && partialInput.length() > 0) ? 0 : -1;
}
public List<String> getStatesByPrefix(String prefix) {