Author: konstantin.mishin
Date: 2009-02-16 11:42:22 -0500 (Mon, 16 Feb 2009)
New Revision: 12672
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/comboBox/comboBoxTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java
Log:
RF-6068
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java 2009-02-16
15:36:29 UTC (rev 12671)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java 2009-02-16
16:42:22 UTC (rev 12672)
@@ -37,6 +37,9 @@
private String value;
private String trace;
+ private Boolean directInputSuggestions;
+ private Boolean filterNewValues;
+ private Boolean selectFirstOnUpdate;
private List<SelectItem> treeItems;
private List<String> treeNames;
@@ -52,6 +55,9 @@
public void init() {
value = null;
trace = null;
+ directInputSuggestions = false;
+ filterNewValues = true;
+ selectFirstOnUpdate = true;
}
/**
@@ -113,4 +119,28 @@
Object value) {
return value != null ? "c:" + value.toString(): null;
}
+
+ public void setDirectInputSuggestions(Boolean directInputSuggestions) {
+ this.directInputSuggestions = directInputSuggestions;
+ }
+
+ public Boolean getDirectInputSuggestions() {
+ return directInputSuggestions;
+ }
+
+ public void setFilterNewValues(Boolean filterNewValues) {
+ this.filterNewValues = filterNewValues;
+ }
+
+ public Boolean getFilterNewValues() {
+ return filterNewValues;
+ }
+
+ public void setSelectFirstOnUpdate(Boolean selectFirstOnUpdate) {
+ this.selectFirstOnUpdate = selectFirstOnUpdate;
+ }
+
+ public Boolean getSelectFirstOnUpdate() {
+ return selectFirstOnUpdate;
+ }
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/comboBox/comboBoxTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java 2009-02-16
15:36:29 UTC (rev 12671)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java 2009-02-16
16:42:22 UTC (rev 12672)
@@ -31,12 +31,14 @@
public class ComboBoxTest extends SeleniumTestBase {
- private String comboBox;
+ private String comboboxField;
private String comboboxButton;
- private String list;
+ private String comboboxList;
+ private String comboboxValue;
+
private String submit;
private String value;
@@ -45,13 +47,24 @@
private String message;
+ private String directInputSuggestions;
+
+ private String filterNewValues;
+
+ private String selectFirstOnUpdate;
+
private void init(Template template) {
renderPage(null, template, "#{comboBean.init}");
- //String attrForm = getParentId() + "attrForm";
+ String attrForm = getParentId() + "attrForm";
+ directInputSuggestions = attrForm + ":directInputSuggestions";
+ filterNewValues = attrForm + ":filterNewValues";
+ selectFirstOnUpdate = attrForm + ":selectFirstOnUpdate";
String mainForm = getParentId() + "_form";
- comboBox = mainForm + ":comboBox";
+ String comboBox = mainForm + ":comboBox";
+ comboboxField = comboBox + "comboboxField";
comboboxButton = comboBox + "comboboxButton";
- list = comboBox + "list";
+ comboboxList = comboBox + "list";
+ comboboxValue = comboBox + "comboboxValue";
submit = mainForm + ":submit";
value = getParentId() + "value";
trace = getParentId() + "trace";
@@ -141,8 +154,8 @@
Assert.assertEquals(selenium.getText(value), "");
Assert.assertEquals(selenium.getText(trace), "");
selenium.click(comboboxButton);
- selenium.mouseMove("xpath=id('" + list + "')/span[2]");
- selenium.click("xpath=id('" + list + "')/span[2]");
+ selenium.mouseMove("xpath=id('" + comboboxList +
"')/span[2]");
+ selenium.click("xpath=id('" + comboboxList +
"')/span[2]");
clickAjaxCommandAndWait(submit);
Assert.assertEquals(selenium.getText(value), "22");
Assert.assertEquals(selenium.getText(trace), "changed");
@@ -158,13 +171,13 @@
init(template);
Assert.assertEquals(selenium.getText(message), "");
selenium.click(comboboxButton);
- selenium.mouseMove("xpath=id('" + list + "')/span[1]");
- selenium.click("xpath=id('" + list + "')/span[1]");
+ selenium.mouseMove("xpath=id('" + comboboxList +
"')/span[1]");
+ selenium.click("xpath=id('" + comboboxList +
"')/span[1]");
clickAjaxCommandAndWait(submit);
Assert.assertEquals(selenium.getText(message), "Value mustn't be equal
11.");
selenium.click(comboboxButton);
- selenium.mouseMove("xpath=id('" + list + "')/span[4]");
- selenium.click("xpath=id('" + list + "')/span[4]");
+ selenium.mouseMove("xpath=id('" + comboboxList +
"')/span[4]");
+ selenium.click("xpath=id('" + comboboxList +
"')/span[4]");
clickAjaxCommandAndWait(submit);
Assert.assertEquals(selenium.getText(message), "Value mustn't be equal
44.");
}
@@ -179,8 +192,8 @@
Assert.assertEquals(selenium.getText(value), "");
Assert.assertEquals(selenium.getText(message), "");
selenium.click(comboboxButton);
- selenium.mouseMove("xpath=id('" + list + "')/span[4]");
- selenium.click("xpath=id('" + list + "')/span[4]");
+ selenium.mouseMove("xpath=id('" + comboboxList +
"')/span[4]");
+ selenium.click("xpath=id('" + comboboxList +
"')/span[4]");
clickAjaxCommandAndWait(submit);
Assert.assertEquals(selenium.getText(value), "");
Assert.assertEquals(selenium.getText(message), "Value mustn't be equal
44.");
@@ -204,9 +217,41 @@
public void testConverter(Template template) {
init(template);
selenium.click(comboboxButton);
- Assert.assertEquals(selenium.getText("xpath=id('" + list +
"')/span[3]"), "c:33");
+ Assert.assertEquals(selenium.getText("xpath=id('" + comboboxList +
"')/span[3]"), "c:33");
}
+ /**
+ * Check components selection, filtering & presentation values
+ * by testing "directInputSuggestions", "filterNewValues",
+ * "selectFirstOnUpdate" attributes.
+ */
+ @Test
+ public void testSelectionFilteringAndPresentation(Template template) {
+ init(template);
+ type(comboboxField, "c");
+ Assert.assertEquals(selenium.getValue(comboboxField), "c");
+ selenium.click(comboboxButton);
+ clickAjaxCommandAndWait(directInputSuggestions);
+ type(comboboxField, "c");
+ Assert.assertEquals(selenium.getValue(comboboxField), "c:11");
+ selenium.click(comboboxButton);
+ clickAjaxCommandAndWait(directInputSuggestions);
+ type(comboboxField, "c:2");
+ Assert.assertEquals(selenium.getXpathCount("id('" + comboboxList +
"')/span").intValue(), 1);
+ selenium.click(comboboxButton);
+ clickAjaxCommandAndWait(filterNewValues);
+ type(comboboxField, "c:2");
+ Assert.assertEquals(selenium.getXpathCount("id('" + comboboxList +
"')/span").intValue(), 4);
+ selenium.click(comboboxButton);
+ clickAjaxCommandAndWait(filterNewValues);
+ selenium.click(comboboxButton);
+ Assert.assertTrue(selenium.getAttribute("xpath=id('" + comboboxList +
"')/span[1](a)class").indexOf("selected") != -1);
+ selenium.click(comboboxButton);
+ clickAjaxCommandAndWait(selectFirstOnUpdate);
+ selenium.click(comboboxButton);
+ Assert.assertFalse(selenium.getAttribute("xpath=id('" + comboboxList +
"')/span[1](a)class").indexOf("selected") != -1);
+ }
+
@Override
public void setValueEmpty() {
selenium.type(getParentId() + "autoTestForm:componentIdcomboboxValue",
"");