Author: konstantin.mishin
Date: 2009-02-12 08:14:38 -0500 (Thu, 12 Feb 2009)
New Revision: 12636
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-6062 RF-6063
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-12
11:01:27 UTC (rev 12635)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ComboBoxTestBean.java 2009-02-12
13:14:38 UTC (rev 12636)
@@ -24,10 +24,14 @@
import java.util.Arrays;
import java.util.List;
+import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
public class ComboBoxTestBean {
+ private String value;
+ private String trace;
+
private List<SelectItem> treeItems;
private List<String> treeNames;
@@ -39,6 +43,11 @@
}
}
+ public void init() {
+ value = null;
+ trace = null;
+ }
+
/**
* Gets value of treeItems field.
* @return value of treeItems field
@@ -55,4 +64,23 @@
return treeNames;
}
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setTrace(String trace) {
+ this.trace = trace;
+ }
+
+ public String getTrace() {
+ return trace;
+ }
+
+ public void valueChangeListener(ValueChangeEvent event) {
+ trace = "changed";
+ }
}
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-12
11:01:27 UTC (rev 12635)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ComboBoxTest.java 2009-02-12
13:14:38 UTC (rev 12636)
@@ -20,13 +20,41 @@
*/
package org.richfaces.testng;
+import java.util.HashMap;
+import java.util.Map;
+
import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
import org.testng.annotations.Test;
public class ComboBoxTest extends SeleniumTestBase {
+
+ private String comboBox;
+ private String comboboxButton;
+
+ private String list;
+
+ private String submit;
+
+ private String value;
+
+ private String trace;
+
+ private void init(Template template) {
+ renderPage(null, template, "#{comboBean.init}");
+ //String attrForm = getParentId() + "attrForm";
+ String mainForm = getParentId() + "_form";
+ comboBox = mainForm + ":comboBox";
+ comboboxButton = comboBox + "comboboxButton";
+ list = comboBox + "list";
+ submit = mainForm + ":submit";
+ value = getParentId() + "value";
+ trace = getParentId() + "trace";
+ }
+
@Test
public void testComboBoxComponent(Template template) {
renderPage(template);
@@ -84,8 +112,47 @@
AssertValueEquals(suggestionValuesCBId + "comboboxValue",
"Maple");
}
+ /**
+ * Check that comboBox component present on the page.
+ * Styles & events attributes work as should.
+ */
+ @Test
+ public void testStandardAttributes(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, null);
+ Map<String, String> styleAttributes = new HashMap<String, String>();
+ styleAttributes.put("width", "100%");
+ styleAttributes.put("color", "yellow");
+ autoTester.testStyleAndClasses(new String[]{"noname"}, styleAttributes);
+ autoTester.testHTMLEvents();
+ }
+
+ /**
+ * Check that valueChangeListener triggered
+ * when user select new value from popup.
+ * Selected value should be correctly applied.
+ */
+ @Test
+ public void testValueAndListener(Template template) {
+ init(template);
+ 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.fireEvent("xpath=id('" + list + "')/span[3]",
"click");
+ clickAjaxCommandAndWait(submit);
+ Assert.assertEquals(selenium.getText(value), "22");
+ Assert.assertEquals(selenium.getText(trace), "changed");
+ }
+
public String getTestUrl() {
return "pages/comboBox/comboBoxTest.xhtml";
}
+
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/comboBox/comboBoxAutoTest.xhtml";
+ }
}
\ No newline at end of file
Show replies by date