JBoss Rich Faces SVN: r23132 - in modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: richTreeModelAdaptor and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2012-01-05 13:17:39 -0500 (Thu, 05 Jan 2012)
New Revision: 23132
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/AbstractTestTreeSelection.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/AbstractTestTree.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSelection.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorSelection.java
Log:
tests for rich:tree refactored
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/AbstractTestTree.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/AbstractTestTree.java 2012-01-05 15:07:31 UTC (rev 23131)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/AbstractTestTree.java 2012-01-05 18:17:39 UTC (rev 23132)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -32,15 +32,14 @@
/**
* @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
*/
-public class AbstractTestTree extends AbstractMetamerTest {
+public abstract class AbstractTestTree extends AbstractMetamerTest {
@Inject
- @Use(strings = {"simpleSwingTreeNode", "simpleRichFacesTreeNode", "simpleRichFacesTreeDataModel"})
+ @Use(strings = { "simpleSwingTreeNode", "simpleRichFacesTreeNode", "simpleRichFacesTreeDataModel" })
private String sample;
@Override
public URL getTestUrl() {
return buildUrl(contextPath, "faces/components/richTree/" + sample + ".xhtml");
}
-
}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/AbstractTestTreeSelection.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/AbstractTestTreeSelection.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/AbstractTestTreeSelection.java 2012-01-05 18:17:39 UTC (rev 23132)
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richTree;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.treeAttributes;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Arrays;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.commons.lang.StringUtils;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.utils.text.SimplifiedFormat;
+import org.richfaces.component.SwitchType;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.testng.annotations.BeforeMethod;
+
+/**
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ */
+public abstract class AbstractTestTreeSelection extends AbstractTestTree {
+
+ @Inject
+ @Use(value = "selectionTypes")
+ protected SwitchType selectionType;
+
+ protected SwitchType[] selectionTypes = new SwitchType[] { SwitchType.ajax, SwitchType.client };
+ protected SwitchType[] selectionTypeAjax = new SwitchType[] { SwitchType.ajax };
+ protected SwitchType[] selectionTypeClient = new SwitchType[] { SwitchType.client };
+ protected SwitchType[] eventEnabledSelectionTypes = new SwitchType[] { SwitchType.ajax };
+
+ protected TreeModel tree = new TreeModel(pjq("div.rf-tr[id$=richTree]"));
+ protected TreeNodeModel treeNode;
+
+ protected Integer[][] selectionPaths = new Integer[][] { { 4, 3 }, { 2, 1, 1 }, { 2 }, { 4, 10, 3 } };
+
+ private JQueryLocator expandAll = jq("input:submit[id$=expandAll]");
+ private JQueryLocator selection = jq("span[id$=selection]");
+ private JQueryLocator clientId = jq("span[id$=selectionEventClientId]");
+ private JQueryLocator newSelection = jq("span[id$=selectionEventNewSelection]");
+ private JQueryLocator oldSelection = jq("span[id$=selectionEventOldSelection]");
+
+ @BeforeMethod
+ public void testInitialize() {
+ treeAttributes.set(TreeAttributes.selectionType, selectionType);
+ tree.setSelectionType(selectionType);
+ }
+
+ protected void testTopLevelSelection() {
+ assertEquals(tree.getAnySelectedNodesCount(), 0);
+
+ for (TreeNodeModel treeNode : tree.getNodes()) {
+ assertFalse(treeNode.isSelected());
+ assertTrue(treeNode.isCollapsed());
+ treeNode.select();
+ assertTrue(treeNode.isSelected());
+ assertTrue(treeNode.isCollapsed());
+
+ assertEquals(tree.getAnySelectedNodesCount(), 1);
+ }
+ }
+
+ protected void testSubNodesSelection() {
+ expandAll();
+ assertEquals(tree.getAnySelectedNodesCount(), 0);
+
+ for (Integer[] path : selectionPaths) {
+ treeNode = null;
+ for (int index : path) {
+ treeNode = (treeNode == null) ? tree.getNode(index) : treeNode.getNode(index);
+ }
+ assertFalse(treeNode.isSelected());
+ treeNode.select();
+ assertTrue(treeNode.isSelected());
+ assertEquals(tree.getAnySelectedNodesCount(), 1);
+ }
+ }
+
+ protected void testSubNodesSelectionEvents() {
+ expandAll();
+ Integer[] old = null;
+ for (Integer[] path : selectionPaths) {
+ treeNode = null;
+ for (int index : path) {
+ treeNode = (treeNode == null) ? tree.getNode(index) : treeNode.getNode(index);
+ }
+ treeNode.select();
+ assertEquals(getClientId(), "richTree");
+ assertEquals(
+ getSelection(),
+ path,
+ SimplifiedFormat.format("Actual Selection ({0}) doesn't correspond to expected ({1})",
+ Arrays.deepToString(getSelection()), Arrays.deepToString(path)));
+ assertEquals(
+ getNewSelection(),
+ path,
+ SimplifiedFormat.format("Actual New selection ({0}) doesn't correspond to expected ({1})",
+ Arrays.deepToString(getNewSelection()), Arrays.deepToString(path)));
+ if (old != null) {
+ assertEquals(
+ getOldSelection(),
+ old,
+ SimplifiedFormat.format("Actual Old selection ({0}) doesn't correspond to expected ({1})",
+ Arrays.deepToString(getOldSelection()), Arrays.deepToString(old)));
+ } else {
+ assertEquals(selenium.getText(oldSelection), "[]");
+ }
+ old = getNewSelection();
+ }
+ }
+
+ protected Integer[] getSelection() {
+ String string = selenium.getText(selection);
+ return getIntsFromString(string);
+ }
+
+ protected Integer[] getNewSelection() {
+ String string = selenium.getText(newSelection);
+ return getIntsFromString(string);
+ }
+
+ protected Integer[] getOldSelection() {
+ String string = selenium.getText(oldSelection);
+ return getIntsFromString(string);
+ }
+
+ protected String getClientId() {
+ return selenium.getText(clientId);
+ }
+
+ protected Integer[] getIntsFromString(String string) {
+ Pattern pattern = Pattern.compile(".*\\[((?:(?:\\d+)(?:, )?)+)\\].*");
+ Matcher matcher = pattern.matcher(string);
+ if (matcher.find()) {
+ String[] strings = StringUtils.split(matcher.group(1), ", ");
+ Integer[] numbers = new Integer[strings.length];
+ for (int i = 0; i < strings.length; i++) {
+ numbers[i] = Integer.valueOf(strings[i]) + 1;
+ }
+ return numbers;
+ }
+ throw new IllegalStateException("pattern does not match");
+ }
+
+ protected void expandAll() {
+ guardXhr(selenium).click(expandAll);
+ }
+}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSelection.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSelection.java 2012-01-05 15:07:31 UTC (rev 23131)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSelection.java 2012-01-05 18:17:39 UTC (rev 23132)
@@ -21,209 +21,78 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richTree;
-import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.richfaces.tests.metamer.ftest.attributes.AttributeList.treeAttributes;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import java.util.Arrays;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.lang.StringUtils;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.jboss.test.selenium.utils.text.SimplifiedFormat;
import org.richfaces.component.SwitchType;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.richfaces.tests.metamer.ftest.annotations.Use;
+import org.richfaces.tests.metamer.ftest.annotations.Uses;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a> * @author <a href="mailto:ppitonak@redhat.com">Pavol
+ * Pitonak</a>
* @version $Revision$
*/
-@Use(field = "selectionPaths", value = "")
-public class TestTreeSelection extends AbstractTestTree {
+public class TestTreeSelection extends AbstractTestTreeSelection {
- protected Integer[][] selectionPaths = new Integer[][] { { 4, 3 }, { 2, 1, 1 }, { 2 }, { 4, 10, 3 } };
-
- protected TreeModel tree = new TreeModel(pjq("div.rf-tr[id$=richTree]"));
- protected TreeNodeModel treeNode;
-
- JQueryLocator expandAll = jq("input:submit[id$=expandAll]");
- JQueryLocator selection = jq("span[id$=selection]");
- JQueryLocator clientId = jq("span[id$=selectionEventClientId]");
- JQueryLocator newSelection = jq("span[id$=selectionEventNewSelection]");
- JQueryLocator oldSelection = jq("span[id$=selectionEventOldSelection]");
-
- public void testInitialize(SwitchType selectionType) {
- treeAttributes.set(TreeAttributes.selectionType, selectionType);
- tree.setSelectionType(selectionType);
- }
-
- public void testTopLevelSelection() {
- assertEquals(tree.getAnySelectedNodesCount(), 0);
-
- for (TreeNodeModel treeNode : tree.getNodes()) {
- assertFalse(treeNode.isSelected());
- assertTrue(treeNode.isCollapsed());
- treeNode.select();
- assertTrue(treeNode.isSelected());
- assertTrue(treeNode.isCollapsed());
-
- assertEquals(tree.getAnySelectedNodesCount(), 1);
- }
- }
-
@Test
+ @Use(field = "selectionType", value = "selectionTypeClient")
public void testTopLevelSelectionClient() {
- testInitialize(SwitchType.client);
testTopLevelSelection();
}
@Test
- @Use(field = "sample", strings = { "simpleSwingTreeNode", "simpleRichFacesTreeDataModel" })
+ @Uses({ @Use(field = "selectionType", value = "selectionTypeAjax"),
+ @Use(field = "sample", strings = { "simpleSwingTreeNode", "simpleRichFacesTreeDataModel" }) })
public void testTopLevelSelectionAjax() {
- testInitialize(SwitchType.ajax);
testTopLevelSelection();
}
@Test(groups = { "4.2" })
@IssueTracking("https://issues.jboss.org/browse/RF-11766")
- @Use(field = "sample", strings = { "simpleRichFacesTreeNode" })
+ @Uses({ @Use(field = "selectionType", value = "selectionTypeAjax"),
+ @Use(field = "sample", strings = { "simpleRichFacesTreeNode" }) })
public void testTopLevelSelectionAjaxWithSimpleTreeNode() {
- testInitialize(SwitchType.ajax);
testTopLevelSelection();
}
- public void testSubNodesSelection() {
- expandAll();
- assertEquals(tree.getAnySelectedNodesCount(), 0);
-
- for (Integer[] path : selectionPaths) {
- treeNode = null;
- for (int index : path) {
- treeNode = (treeNode == null) ? tree.getNode(index) : treeNode.getNode(index);
- }
- assertFalse(treeNode.isSelected());
- treeNode.select();
- assertTrue(treeNode.isSelected());
- assertEquals(tree.getAnySelectedNodesCount(), 1);
- }
- }
-
@Test
+ @Use(field = "selectionType", value = "selectionTypeClient")
public void testSubNodesSelectionClient() {
- testInitialize(SwitchType.client);
testSubNodesSelection();
}
@Test
- @Use(field = "sample", strings = { "simpleSwingTreeNode", "simpleRichFacesTreeDataModel" })
+ @Uses({ @Use(field = "selectionType", value = "selectionTypeAjax"),
+ @Use(field = "sample", strings = { "simpleSwingTreeNode", "simpleRichFacesTreeDataModel" }) })
public void testSubNodesSelectionAjax() {
- testInitialize(SwitchType.ajax);
testSubNodesSelection();
}
@Test(groups = { "4.2" })
@IssueTracking("https://issues.jboss.org/browse/RF-11766")
- @Use(field = "sample", strings = { "simpleRichFacesTreeNode" })
+ @Uses({ @Use(field = "selectionType", value = "selectionTypeAjax"),
+ @Use(field = "sample", strings = { "simpleRichFacesTreeNode" }) })
public void testSubNodesSelectionAjaxWithSimpleTreeNode() {
- testInitialize(SwitchType.ajax);
testSubNodesSelection();
}
- public void testSubNodesSelectionEvents() {
- expandAll();
- Integer[] old = null;
- for (Integer[] path : selectionPaths) {
- treeNode = null;
- for (int index : path) {
- treeNode = (treeNode == null) ? tree.getNode(index) : treeNode.getNode(index);
- }
- treeNode.select();
- assertEquals(getClientId(), "richTree");
- assertEquals(
- getSelection(),
- path,
- SimplifiedFormat.format("Actual Selection ({0}) doesn't correspond to expected ({1})",
- Arrays.deepToString(getSelection()), Arrays.deepToString(path)));
- assertEquals(
- getNewSelection(),
- path,
- SimplifiedFormat.format("Actual New selection ({0}) doesn't correspond to expected ({1})",
- Arrays.deepToString(getNewSelection()), Arrays.deepToString(path)));
- if (old != null) {
- assertEquals(
- getOldSelection(),
- old,
- SimplifiedFormat.format("Actual Old selection ({0}) doesn't correspond to expected ({1})",
- Arrays.deepToString(getOldSelection()), Arrays.deepToString(old)));
- } else {
- assertEquals(selenium.getText(oldSelection), "[]");
- }
- old = getNewSelection();
- }
- }
-
- @Test(groups = { "4.2" })
- @IssueTracking("https://issues.jboss.org/browse/RF-11766")
- public void testSubNodesSelectionEventsClient() {
- testInitialize(SwitchType.client);
- testSubNodesSelectionEvents();
- }
-
@Test
- @Use(field = "sample", strings = { "simpleSwingTreeNode", "simpleRichFacesTreeDataModel" })
+ @Uses({ @Use(field = "selectionType", value = "eventEnabledSelectionTypes"),
+ @Use(field = "sample", strings = { "simpleSwingTreeNode", "simpleRichFacesTreeDataModel" }) })
public void testSubNodesSelectionEventsAjax() {
- testInitialize(SwitchType.ajax);
testSubNodesSelectionEvents();
}
@Test(groups = { "4.2" })
@IssueTracking("https://issues.jboss.org/browse/RF-11766")
- @Use(field = "sample", strings = { "simpleRichFacesTreeNode" })
+ @Uses({ @Use(field = "selectionType", value = "eventEnabledSelectionTypes"),
+ @Use(field = "sample", strings = { "simpleRichFacesTreeNode" }) })
public void testSubNodesSelectionEventsAjaxWithSimpleTreeNode() {
- testInitialize(SwitchType.ajax);
testSubNodesSelectionEvents();
}
- protected void expandAll() {
- guardXhr(selenium).click(expandAll);
- }
-
- protected Integer[] getIntsFromString(String string) {
- Pattern pattern = Pattern.compile(".*\\[((?:(?:\\d+)(?:, )?)+)\\].*");
- Matcher matcher = pattern.matcher(string);
- if (matcher.find()) {
- String[] strings = StringUtils.split(matcher.group(1), ", ");
- Integer[] numbers = new Integer[strings.length];
- for (int i = 0; i < strings.length; i++) {
- numbers[i] = Integer.valueOf(strings[i]) + 1;
- }
- return numbers;
- }
- throw new IllegalStateException("pattern does not match");
- }
-
- private Integer[] getSelection() {
- String string = selenium.getText(selection);
- return getIntsFromString(string);
- }
-
- private Integer[] getNewSelection() {
- String string = selenium.getText(newSelection);
- return getIntsFromString(string);
- }
-
- private Integer[] getOldSelection() {
- String string = selenium.getText(oldSelection);
- return getIntsFromString(string);
- }
-
- private String getClientId() {
- return selenium.getText(clientId);
- }
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorSelection.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorSelection.java 2012-01-05 15:07:31 UTC (rev 23131)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTreeModelAdaptor/TestTreeModelAdaptorSelection.java 2012-01-05 18:17:39 UTC (rev 23132)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -33,7 +33,7 @@
import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.Use;
import org.richfaces.tests.metamer.ftest.annotations.Uses;
-import org.richfaces.tests.metamer.ftest.richTree.TestTreeSelection;
+import org.richfaces.tests.metamer.ftest.richTree.AbstractTestTreeSelection;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -41,15 +41,15 @@
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class TestTreeModelAdaptorSelection extends TestTreeSelection {
-
+public class TestTreeModelAdaptorSelection extends AbstractTestTreeSelection {
+
@Inject
PathsCrate paths;
- PathsCrate pathsForListModel = new PathsCrate("listModel", new Integer[][] {{2, 1, 3 }, {3, 3, 2, 2 } });
- PathsCrate pathsForMapModel = new PathsCrate("mapModel", new Integer[][] {{2, 1, 5 }, {3, 3, 2, 6 } });
- PathsCrate pathsForRecursiveModel = new PathsCrate("recursiveModel", new Integer[][] {{4, 1, 10, 2 },
- {1, 4, 3, 11, 4 } });
-
+ PathsCrate pathsForListModel = new PathsCrate("listModel", new Integer[][] { { 2, 1, 3 }, { 3, 3, 2, 2 } });
+ PathsCrate pathsForMapModel = new PathsCrate("mapModel", new Integer[][] { { 2, 1, 5 }, { 3, 3, 2, 6 } });
+ PathsCrate pathsForRecursiveModel = new PathsCrate("recursiveModel", new Integer[][] { { 4, 1, 10, 2 },
+ { 1, 4, 3, 11, 4 } });
+
@Inject
@Use(enumeration = true)
private RecursiveModelRepresentation representation;
@@ -76,23 +76,23 @@
}
@Test
+ @Use(field = "paths", empty = true)
@Override
- @Use(field = "paths", empty = true)
public void testTopLevelSelection() {
super.testTopLevelSelection();
}
@Test
+ @Use(field = "paths", value = "paths*")
@Override
- @Use(field = "paths", value = "paths*")
public void testSubNodesSelection() {
super.testSubNodesSelection();
}
@Test
- @Override
@Uses({ @Use(field = "paths", value = "paths*"),
@Use(field = "selectionType", value = "eventEnabledSelectionTypes") })
+ @Override
public void testSubNodesSelectionEvents() {
super.testSubNodesSelectionEvents();
}
12 years, 11 months
JBoss Rich Faces SVN: r23131 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey.
by richfaces-svn-commits@lists.jboss.org
Author: jpapouse
Date: 2012-01-05 10:07:31 -0500 (Thu, 05 Jan 2012)
New Revision: 23131
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/TestRichHotKeyAttributes.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/AbstractRichHotKeyTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/HotKeyAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/TestRichHotKey.java
Log:
tests for rich:hotKey component (attributes)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/AbstractRichHotKeyTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/AbstractRichHotKeyTest.java 2012-01-05 13:28:33 UTC (rev 23130)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/AbstractRichHotKeyTest.java 2012-01-05 15:07:31 UTC (rev 23131)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010-2012s, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -21,9 +21,13 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richHotKey;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+
import java.net.URL;
+import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.utils.URLUtils;
+import org.jboss.test.selenium.waiting.NegationCondition;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.richfaces.tests.metamer.ftest.attributes.Attributes;
@@ -32,11 +36,34 @@
*/
public abstract class AbstractRichHotKeyTest extends AbstractMetamerTest {
+ protected static final String INPUT_1_LOCATOR = "input.first-input";
+ protected static final String INPUT_2_LOCATOR = "input.second-input";
+
+ protected static final JQueryLocator HOTKEY_1 = pjq("span[id$=richHotKey1]");
+ protected static final JQueryLocator HOTKEY_2 = pjq("span[id$=richHotKey2]");
+
+ protected static final JQueryLocator INPUT_1 = pjq(INPUT_1_LOCATOR);
+ protected static final JQueryLocator INPUT_2 = pjq(INPUT_2_LOCATOR);
+
+ private static final JQueryLocator CLEAR_BUTTON = pjq("button.rf-log-element");
+ private static final String HOT_KEY_EVENT_LOCATOR = "span.rf-log-entry-msg-info:contains({0})";
+
@Override
public URL getTestUrl() {
return URLUtils.buildUrl(contextPath, "faces/components/richHotKey/simple.xhtml");
}
+ protected void checkEvent(String text, int number) {
+ waitGui
+ .failWith("The number of hotkey events doesn't match. Found <" + selenium.getCount(pjq(format(HOT_KEY_EVENT_LOCATOR, text))) + ">, expected <" + number + ">.")
+ .until(countEquals.locator(pjq(format(HOT_KEY_EVENT_LOCATOR, text))).count(number));
+ }
+
+ protected void clearHotKeyEvents() {
+ selenium.click(CLEAR_BUTTON);
+ waitGui.until(NegationCondition.getInstance().condition(elementPresent.locator(pjq(format(HOT_KEY_EVENT_LOCATOR, "''")))));
+ }
+
protected static final Attributes<HotKeyAttributes> ATTRIBUTES_FIRST = new Attributes<HotKeyAttributes>(pjq("table.attributes[id$=attributes1]"));
protected static final Attributes<HotKeyAttributes> ATTRIBUTES_SECOND = new Attributes<HotKeyAttributes>(pjq("table.attributes[id$=attributes2]"));
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/HotKeyAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/HotKeyAttributes.java 2012-01-05 13:28:33 UTC (rev 23130)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/HotKeyAttributes.java 2012-01-05 15:07:31 UTC (rev 23131)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/TestRichHotKey.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/TestRichHotKey.java 2012-01-05 13:28:33 UTC (rev 23130)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/TestRichHotKey.java 2012-01-05 15:07:31 UTC (rev 23131)
@@ -36,10 +36,6 @@
private static final int NUMBER_OF_TESTS = 5;
- private final JQueryLocator clearButton = pjq("button.rf-log-element");
- private final JQueryLocator firstInput = pjq("input[id$=firstInput]");
- private final String hotKeyEeventLocator = "span.rf-log-entry-msg-info:contains({0})";
-
@Test
public void testFirstAndSecondPair() {
for (int i=1; i<=NUMBER_OF_TESTS; i++) {
@@ -65,7 +61,6 @@
@Test
public void testFirstOne() {
ATTRIBUTES_FIRST.set(HotKeyAttributes.key, "x");
- selenium.focus(firstInput);
for (int i=1; i<=NUMBER_OF_TESTS; i++) {
for (int j=0; j<i; j++) {
selenium.keyPressNative(String.valueOf(KeyEvent.VK_X));
@@ -87,19 +82,9 @@
testPair(KeyEvent.VK_ALT, KeyEvent.VK_X, "hotkey 2");
}
- private void checkEvent(String text, int number) {
- waitGui
- .failWith("The number of hotkey events doesn't match. Found <" + selenium.getCount(pjq(format(hotKeyEeventLocator, text))) + ">, expected <" + number + ">.")
- .until(countEquals.locator(pjq(format(hotKeyEeventLocator, text))).count(number));
- }
-
- private void clearHotKeyEvents() {
- selenium.click(clearButton);
- waitGui.until(NegationCondition.getInstance().condition(elementPresent.locator(pjq(format(hotKeyEeventLocator, "''")))));
- }
+
private void testPair(int firstKey, int secondKey, String text) {
- selenium.focus(firstInput);
for (int i=1; i<=NUMBER_OF_TESTS; i++) {
for (int j=0; j<i; j++) {
selenium.keyPressNative(String.valueOf(firstKey));
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/TestRichHotKeyAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/TestRichHotKeyAttributes.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/TestRichHotKeyAttributes.java 2012-01-05 15:07:31 UTC (rev 23131)
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richHotKey;
+
+import java.awt.event.KeyEvent;
+
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+
+/**
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class TestRichHotKeyAttributes extends AbstractRichHotKeyTest {
+
+ @AfterMethod
+ public void tearDown() {
+ selenium.keyUpNative(String.valueOf(KeyEvent.VK_CONTROL));
+ selenium.keyUpNative(String.valueOf(KeyEvent.VK_ALT));
+ selenium.keyUpNative(String.valueOf(KeyEvent.VK_M));
+ selenium.keyUpNative(String.valueOf(KeyEvent.VK_X));
+ }
+
+ @Test
+ public void enabledInInput() {
+ ATTRIBUTES_FIRST.set(HotKeyAttributes.key, "x");
+ // true
+ selenium.focus(INPUT_1);
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_X));
+ checkEvent("hotkey 1", 1);
+ clearHotKeyEvents();
+ // false
+ ATTRIBUTES_FIRST.set(HotKeyAttributes.enabledInInput, false);
+ selenium.focus(INPUT_1);
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_X));
+ checkEvent("hotkey 1", 0);
+ }
+
+ @Test
+ public void testRendered() {
+ ATTRIBUTES_FIRST.set(HotKeyAttributes.rendered, false);
+ ATTRIBUTES_FIRST.set(HotKeyAttributes.key, "x");
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_X));
+ checkEvent("hotkey 1", 0);
+ }
+
+ @Test
+ public void testSelector() {
+ ATTRIBUTES_FIRST.set(HotKeyAttributes.key, "x");
+ ATTRIBUTES_FIRST.set(HotKeyAttributes.selector, INPUT_1_LOCATOR);
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_X));
+ checkEvent("hotkey 1", 0);
+ selenium.focus(INPUT_2);
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_X));
+ checkEvent("hotkey 1", 0);
+ selenium.focus(INPUT_1);
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_X));
+ checkEvent("hotkey 1", 1);
+ }
+
+ @Test
+ public void testTypeKeydownOne() {
+ testTypeOne("keydown", 3, KeyEvent.VK_CONTROL, "ctrl");
+ }
+
+ @Test
+ public void testTypeKeydownPair() {
+ testTypePair("keydown", 3, KeyEvent.VK_ALT, KeyEvent.VK_CONTROL, "alt+ctrl");
+ }
+
+ @Test
+ public void testTypeKeypressOne() {
+ testTypeOne("keypress", 0, KeyEvent.VK_CONTROL, "ctrl");
+ tearDown();
+ testTypeOne("keypress", 3, KeyEvent.VK_X, "x");
+ }
+
+ @Test
+ public void testTypeKeypressPair() {
+ testTypePair("keypress", 3, KeyEvent.VK_CONTROL, KeyEvent.VK_X, "ctrl+x");
+ }
+
+ @Test
+ public void testTypeKeyupOne() {
+ testTypeOne("keyup", 2, KeyEvent.VK_CONTROL, "ctrl");
+ }
+
+ @Test
+ public void testTypeKeyupPair() {
+ testTypePair("keyup", 2, KeyEvent.VK_ALT, KeyEvent.VK_CONTROL, "alt+ctrl");
+ }
+
+ private void processOneKeySequence(int correctKey, int wrongKey) {
+ selenium.keyDownNative(String.valueOf(correctKey));
+ selenium.keyDownNative(String.valueOf(wrongKey));
+ selenium.keyUpNative(String.valueOf(correctKey));
+ selenium.keyUpNative(String.valueOf(wrongKey));
+ selenium.keyPressNative(String.valueOf(correctKey));
+ selenium.keyPressNative(String.valueOf(wrongKey));
+ selenium.keyDownNative(String.valueOf(correctKey));
+ selenium.keyDownNative(String.valueOf(wrongKey));
+ }
+
+ private void processPairKeySequence(int firstKey, int secondCorrectKey, int secondWrongKey) {
+ selenium.keyDownNative(String.valueOf(firstKey));
+ processOneKeySequence(secondCorrectKey, secondWrongKey);
+ }
+
+ private void testTypeOne(String event, int number, int correctKeyCode, String correctKeyName) {
+ ATTRIBUTES_FIRST.set(HotKeyAttributes.key, correctKeyName);
+ ATTRIBUTES_FIRST.set(HotKeyAttributes.type, event);
+ processOneKeySequence(correctKeyCode, KeyEvent.VK_M);
+ checkEvent("hotkey 1", number);
+ clearHotKeyEvents();
+ }
+
+ private void testTypePair(String event, int number, int firstCorrectKeyCode, int secondCorrectKeyCode, String keyNames) {
+ ATTRIBUTES_FIRST.set(HotKeyAttributes.key, keyNames);
+ ATTRIBUTES_FIRST.set(HotKeyAttributes.type, event);
+ processPairKeySequence(firstCorrectKeyCode, secondCorrectKeyCode, KeyEvent.VK_M);
+ checkEvent("hotkey 1", number);
+ clearHotKeyEvents();
+ }
+
+}
12 years, 11 months
JBoss Rich Faces SVN: r23130 - in modules/tests/metamer/branches/contextMenu/application/src/main: resources/org/richfaces/tests/metamer/bean/rich and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2012-01-05 08:28:33 -0500 (Thu, 05 Jan 2012)
New Revision: 23130
Added:
modules/tests/metamer/branches/contextMenu/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.properties
Modified:
modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.java
modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/simple.xhtml
Log:
RF-10197: tweaks on rich:contextMenu example
Added some default values for type-safe sensitive attributes, added new default values into RichContextMenuBean...
Modified: modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.java
===================================================================
--- modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.java 2012-01-05 13:28:12 UTC (rev 23129)
+++ modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.java 2012-01-05 13:28:33 UTC (rev 23130)
@@ -53,6 +53,7 @@
attributes.setAttribute("attachTo", "form:panelClick");
attributes.setAttribute("disabled", "false");
attributes.setAttribute("rendered", "true");
+ attributes.setAttribute("hideDelay", "600");
}
public Attributes getAttributes() {
Added: modules/tests/metamer/branches/contextMenu/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.properties
===================================================================
--- modules/tests/metamer/branches/contextMenu/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.properties (rev 0)
+++ modules/tests/metamer/branches/contextMenu/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.properties 2012-01-05 13:28:33 UTC (rev 23130)
@@ -0,0 +1,21 @@
+attr.direction.auto=auto
+attr.direction.topLeft=topLeft
+attr.direction.topRight=topRight
+attr.direction.bottomLeft=bottomLeft
+attr.direction.bottomRight=bottomRight
+attr.direction.autoLeft=autoLeft
+attr.direction.autoRight=autoRight
+attr.direction.topAuto=topAuto
+attr.direction.bottomAuto=bottomAuto
+attr.jointPoint.auto=auto
+attr.jointPoint.topLeft=topLeft
+attr.jointPoint.topRight=topRight
+attr.jointPoint.bottomLeft=bottomLeft
+attr.jointPoint.bottomRight=bottomRight
+attr.jointPoint.autoLeft=autoLeft
+attr.jointPoint.autoRight=autoRight
+attr.jointPoint.topAuto=topAuto
+attr.jointPoint.bottomAuto=bottomAuto
+attr.mode.ajax=ajax
+attr.mode.client=client
+attr.mode.server=server
Modified: modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/simple.xhtml
===================================================================
--- modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/simple.xhtml 2012-01-05 13:28:12 UTC (rev 23129)
+++ modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/simple.xhtml 2012-01-05 13:28:33 UTC (rev 23130)
@@ -37,7 +37,7 @@
</ui:define>
<ui:define name="component">
- <h:panelGroup layout="block" style="width:300px; background-color: lightgreen; padding: 15px" id="panelClick">
+ <h:panelGroup layout="block" style="width:500px; background-color: lightgreen; padding: 15px" id="panelClick">
Righ click here for a contextMenu
</h:panelGroup>
<rich:contextMenu id="ctxmenu"
12 years, 11 months
JBoss Rich Faces SVN: r23129 - in modules/tests/metamer/branches/contextMenu/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: attributes and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2012-01-05 08:28:12 -0500 (Thu, 05 Jan 2012)
New Revision: 23129
Added:
modules/tests/metamer/branches/contextMenu/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richContextMenu/
modules/tests/metamer/branches/contextMenu/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richContextMenu/ContextMenuAttributes.java
Modified:
modules/tests/metamer/branches/contextMenu/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
Log:
RF-10197: Add rich:contextMenu attributes list
Add attributes list into ftest-source for rich:contextMenu component
Modified: modules/tests/metamer/branches/contextMenu/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java
===================================================================
--- modules/tests/metamer/branches/contextMenu/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2012-01-05 13:27:55 UTC (rev 23128)
+++ modules/tests/metamer/branches/contextMenu/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/attributes/AttributeList.java 2012-01-05 13:28:12 UTC (rev 23129)
@@ -16,6 +16,7 @@
import org.richfaces.tests.metamer.ftest.richCollapsibleSubTableToggler.CollapsibleSubTableTogglerAttributes;
import org.richfaces.tests.metamer.ftest.richColumn.ColumnAttributes;
import org.richfaces.tests.metamer.ftest.richComponentControl.ComponentControlAttributes;
+import org.richfaces.tests.metamer.ftest.richContextMenu.ContextMenuAttributes;
import org.richfaces.tests.metamer.ftest.richDataScroller.DataScrollerAttributes;
import org.richfaces.tests.metamer.ftest.richDragIndicator.DragIndicatorAttributes;
import org.richfaces.tests.metamer.ftest.richDragSource.DragSourceAttributes;
@@ -65,5 +66,6 @@
public static Attributes<PickListAttributes> pickListAttributes = new Attributes<PickListAttributes>();
public static Attributes<TreeAttributes> treeAttributes = new Attributes<TreeAttributes>(jq("span[id*=attributes]"));
public static Attributes<MenuItemAttributes> menuItemAttributes = new Attributes<MenuItemAttributes>();
+ public static Attributes<ContextMenuAttributes> contextMenuAttributes = new Attributes<ContextMenuAttributes>();
}
Added: modules/tests/metamer/branches/contextMenu/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richContextMenu/ContextMenuAttributes.java
===================================================================
--- modules/tests/metamer/branches/contextMenu/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richContextMenu/ContextMenuAttributes.java (rev 0)
+++ modules/tests/metamer/branches/contextMenu/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richContextMenu/ContextMenuAttributes.java 2012-01-05 13:28:12 UTC (rev 23129)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.tests.metamer.ftest.richContextMenu;
+
+import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
+
+/**
+ * Component attributes for rich:contextMenu
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ * @version $Revision$
+ */
+public enum ContextMenuAttributes implements AttributeEnum {
+ attachTo,
+ dir,
+ direction,
+ disabled,
+ hideDelay,
+ horizontalOffset,
+ jointPoint,
+ label,
+ lang,
+ mode,
+ onclick,
+ ondblclick,
+ ongrouphide,
+ ongroupshow,
+ onhide,
+ onitemclick,
+ onkeydown,
+ onkeypress,
+ onkeyup,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup,
+ onshow,
+ popupWidth,
+ endered,
+ showDelay,
+ showEvent,
+ style,
+ styleClass,
+ title,
+ verticalOffset
+}
12 years, 11 months
JBoss Rich Faces SVN: r23128 - in modules/tests/metamer/branches/contextMenu/application/src/main: java/org/richfaces/tests/metamer/bean/rich and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2012-01-05 08:27:55 -0500 (Thu, 05 Jan 2012)
New Revision: 23128
Added:
modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.java
modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/
modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/list.xhtml
modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/simple.xhtml
Modified:
modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
RF-10197: add simple example for rich:contextMenu
Add page for rich:contextMenu, with attribute mappings and default values preset.
Modified: modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
--- modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2012-01-05 13:01:50 UTC (rev 23127)
+++ modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2012-01-05 13:27:55 UTC (rev 23128)
@@ -132,6 +132,7 @@
richComponents.put("richColumn", "Rich Column");
richComponents.put("richColumnGroup", "Rich Column Group");
richComponents.put("richComponentControl", "Rich Component Control");
+ richComponents.put("richContextMenu", "Rich Context Menu");
richComponents.put("richDataGrid", "Rich Data Grid");
richComponents.put("richDataScroller", "Rich Data Scroller");
richComponents.put("richDataTable", "Rich Data Table");
Added: modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.java
===================================================================
--- modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.java (rev 0)
+++ modules/tests/metamer/branches/contextMenu/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichContextMenuBean.java 2012-01-05 13:27:55 UTC (rev 23128)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.tests.metamer.bean.rich;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+
+import org.richfaces.component.UIContextMenu;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for rich:contextMenu
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richContextMenuBean")
+public class RichContextMenuBean implements Serializable {
+
+ /** Generated serial version UID */
+ private static final long serialVersionUID = 1323565239250527128L;
+ private static Logger log = LoggerFactory.getLogger(RichContextMenuBean.class);
+
+ private Attributes attributes;
+
+ @PostConstruct
+ public void init() {
+ log.info("ContextMenu attributes initialized.");
+ attributes = Attributes.getComponentAttributesFromFacesConfig(UIContextMenu.class, getClass());
+ attributes.setAttribute("attachTo", "form:panelClick");
+ attributes.setAttribute("disabled", "false");
+ attributes.setAttribute("rendered", "true");
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+}
Added: modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/list.xhtml
===================================================================
--- modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/list.xhtml (rev 0)
+++ modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/list.xhtml 2012-01-05 13:27:55 UTC (rev 23128)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/list.xhtml">
+
+ <ui:define name="pageTitle">Rich Context Menu</ui:define>
+
+ <ui:define name="links">
+
+ <metamer:testPageLink id="simple" outcome="simple" value="Simple">
+ Simple page that contains rich:contextMenu
+ </metamer:testPageLink>
+
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added: modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/simple.xhtml
===================================================================
--- modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/simple.xhtml (rev 0)
+++ modules/tests/metamer/branches/contextMenu/application/src/main/webapp/components/richContextMenu/simple.xhtml 2012-01-05 13:27:55 UTC (rev 23128)
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:metamer="http://java.sun.com/jsf/composite/metamer"
+ xmlns:rich="http://richfaces.org/rich" >
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="view">
+ <f:metadata>
+ <f:viewParam name="templates" value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="component">
+ <h:panelGroup layout="block" style="width:300px; background-color: lightgreen; padding: 15px" id="panelClick">
+ Righ click here for a contextMenu
+ </h:panelGroup>
+ <rich:contextMenu id="ctxmenu"
+ attachTo="#{richContextMenuBean.attributes['attachTo'].value}"
+ dir="#{richContextMenuBean.attributes['dir'].value}"
+ direction="#{richContextMenuBean.attributes['direction'].value}"
+ disabled="#{richContextMenuBean.attributes['disabled'].value}"
+ hideDelay="#{richContextMenuBean.attributes['hideDelay'].value}"
+ horizontalOffset="#{richContextMenuBean.attributes['horizontalOffset'].value}"
+ jointPoint="#{richContextMenuBean.attributes['jointPoint'].value}"
+ label="#{richContextMenuBean.attributes['label'].value}"
+ lang="#{richContextMenuBean.attributes['lang'].value}"
+ mode="#{richContextMenuBean.attributes['mode'].value}"
+ onclick="#{richContextMenuBean.attributes['onclick'].value}"
+ ondblclick="#{richContextMenuBean.attributes[''].value}"
+ ongrouphide="#{richContextMenuBean.attributes['ongrouphide'].value}"
+ ongroupshow="#{richContextMenuBean.attributes['ongroupshow'].value}"
+ onhide="#{richContextMenuBean.attributes['onhide'].value}"
+ onitemclick="#{richContextMenuBean.attributes['onitemclick'].value}"
+ onkeydown="#{richContextMenuBean.attributes['onkeydown'].value}"
+ onkeypress="#{richContextMenuBean.attributes['onkeypress'].value}"
+ onkeyup="#{richContextMenuBean.attributes['onkeyup'].value}"
+ onmousedown="#{richContextMenuBean.attributes['onmousedown'].value}"
+ onmousemove="#{richContextMenuBean.attributes['onmousemove'].value}"
+ onmouseout="#{richContextMenuBean.attributes['onmouseout'].value}"
+ onmouseover="#{richContextMenuBean.attributes['onmouseover'].value}"
+ onmouseup="#{richContextMenuBean.attributes['onmouseup'].value}"
+ onshow="#{richContextMenuBean.attributes['onshow'].value}"
+ popupWidth="#{richContextMenuBean.attributes['popupWidth'].value}"
+ rendered="#{richContextMenuBean.attributes['rendered'].value}"
+ showDelay="#{richContextMenuBean.attributes['showDelay'].value}"
+ showEvent="#{richContextMenuBean.attributes['showEvent'].value}"
+ style="#{richContextMenuBean.attributes['showEvent'].value}"
+ styleClass="#{richContextMenuBean.attributes['styleClass'].value}"
+ title="#{richContextMenuBean.attributes['title'].value}"
+ verticalOffset="#{richContextMenuBean.attributes['verticalOffset'].value}"
+ >
+ <rich:menuItem id="menuItem2" label="Open" icon="/resources/images/icons/open.gif" />
+
+ <rich:menuGroup id="menuGroup3" label="Open Recent..." disabled="true">
+ <rich:menuItem id="menuItem31" label="Save" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem32" label="Save All">
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons" name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ </rich:menuGroup>
+
+ <rich:menuSeparator id="menuSeparator11" />
+
+ <rich:menuGroup id="menuGroup4" label="Save As...">
+ <rich:menuItem id="menuItem41" label="Save" icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem42" label="Save All" >
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons" name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ <rich:menuItem id="menuItem43" label="Send Online" icon="/resources/images/icons/save.gif" disabled="true" />
+ </rich:menuGroup>
+
+ <rich:menuItem id="menuItem5" label="Print" disabled="true"/>
+
+ <rich:menuItem id="menuItem6" label="Close" />
+
+ <rich:menuSeparator id="menuSeparator12" />
+
+ <rich:menuItem id="menuItem7" label="Exit" />
+ </rich:contextMenu>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <metamer:attributes value="#{richContextMenuBean.attributes}" id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
12 years, 11 months
JBoss Rich Faces SVN: r23127 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2012-01-05 08:01:50 -0500 (Thu, 05 Jan 2012)
New Revision: 23127
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
Log:
imports organized
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2012-01-04 15:19:57 UTC (rev 23126)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2012-01-05 13:01:50 UTC (rev 23127)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -50,8 +50,6 @@
import org.apache.commons.lang.LocaleUtils;
import org.jboss.cheiron.retriever.ScriptEvaluationRetriever;
import org.jboss.test.selenium.AbstractTestCase;
-import org.jboss.test.selenium.SystemProperties;
-import org.jboss.test.selenium.browser.BrowserType;
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.Attribute;
@@ -68,8 +66,6 @@
import org.richfaces.tests.metamer.TemplatesList;
import org.richfaces.tests.metamer.ftest.annotations.Inject;
import org.richfaces.tests.metamer.ftest.annotations.Templates;
-import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
-import org.richfaces.tests.metamer.ftest.attributes.Attributes;
import org.testng.SkipException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
12 years, 11 months
JBoss Rich Faces SVN: r23126 - in modules/tests/metamer/trunk: ftest-source/src/main/java/org/richfaces/tests/metamer/ftest and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: jpapouse
Date: 2012-01-04 10:19:57 -0500 (Wed, 04 Jan 2012)
New Revision: 23126
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/AbstractRichHotKeyTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/HotKeyAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/TestRichHotKey.java
Modified:
modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml
Log:
tests for rich:hotKey
Modified: modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml
===================================================================
--- modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml 2012-01-04 14:35:01 UTC (rev 23125)
+++ modules/tests/metamer/trunk/ftest/src/test/resources/testng-misc.xml 2012-01-04 15:19:57 UTC (rev 23126)
@@ -16,6 +16,7 @@
<package name="org.richfaces.tests.metamer.ftest.richFunctions" />
<package name="org.richfaces.tests.metamer.ftest.richGraphValidator" />
<package name="org.richfaces.tests.metamer.ftest.richHashParam" />
+ <package name="org.richfaces.tests.metamer.ftest.richHotKey" />
<package name="org.richfaces.tests.metamer.ftest.richJQuery" />
<package name="org.richfaces.tests.metamer.ftest.richMenuGroup" />
<package name="org.richfaces.tests.metamer.ftest.richMenuItem" />
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/AbstractRichHotKeyTest.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/AbstractRichHotKeyTest.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/AbstractRichHotKeyTest.java 2012-01-04 15:19:57 UTC (rev 23126)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2012s, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richHotKey;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.utils.URLUtils;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.attributes.Attributes;
+
+/**
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public abstract class AbstractRichHotKeyTest extends AbstractMetamerTest {
+
+ @Override
+ public URL getTestUrl() {
+ return URLUtils.buildUrl(contextPath, "faces/components/richHotKey/simple.xhtml");
+ }
+
+ protected static final Attributes<HotKeyAttributes> ATTRIBUTES_FIRST = new Attributes<HotKeyAttributes>(pjq("table.attributes[id$=attributes1]"));
+
+ protected static final Attributes<HotKeyAttributes> ATTRIBUTES_SECOND = new Attributes<HotKeyAttributes>(pjq("table.attributes[id$=attributes2]"));
+
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/HotKeyAttributes.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/HotKeyAttributes.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/HotKeyAttributes.java 2012-01-04 15:19:57 UTC (rev 23126)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richHotKey;
+
+import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum;
+
+/**
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public enum HotKeyAttributes implements AttributeEnum {
+
+ enabledInInput,
+ key,
+ rendered,
+ selector,
+ type
+
+}
Added: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/TestRichHotKey.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/TestRichHotKey.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richHotKey/TestRichHotKey.java 2012-01-04 15:19:57 UTC (rev 23126)
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richHotKey;
+
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+
+import java.awt.event.KeyEvent;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.waiting.NegationCondition;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:jpapouse@redhat.com">Jan Papousek</a>
+ */
+public class TestRichHotKey extends AbstractRichHotKeyTest {
+
+ private static final int NUMBER_OF_TESTS = 5;
+
+ private final JQueryLocator clearButton = pjq("button.rf-log-element");
+ private final JQueryLocator firstInput = pjq("input[id$=firstInput]");
+ private final String hotKeyEeventLocator = "span.rf-log-entry-msg-info:contains({0})";
+
+ @Test
+ public void testFirstAndSecondPair() {
+ for (int i=1; i<=NUMBER_OF_TESTS; i++) {
+ for (int j=0; j<i; j++) {
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_CONTROL));
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_X));
+ selenium.keyDownNative(String.valueOf(KeyEvent.VK_CONTROL));
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_X));
+ selenium.keyUpNative(String.valueOf(KeyEvent.VK_CONTROL));
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_ALT));
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_X));
+ selenium.keyDownNative(String.valueOf(KeyEvent.VK_ALT));
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_X));
+ selenium.keyUpNative(String.valueOf(KeyEvent.VK_ALT));
+ }
+ checkEvent("hotkey 1", i);
+ checkEvent("hotkey 2", i);
+ checkEvent("''", 2 * i);
+ clearHotKeyEvents();
+ }
+ }
+
+ @Test
+ public void testFirstOne() {
+ ATTRIBUTES_FIRST.set(HotKeyAttributes.key, "x");
+ selenium.focus(firstInput);
+ for (int i=1; i<=NUMBER_OF_TESTS; i++) {
+ for (int j=0; j<i; j++) {
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_X));
+ selenium.keyPressNative(String.valueOf(KeyEvent.VK_A));
+ }
+ checkEvent("hotkey 1", i);
+ checkEvent("''", i);
+ clearHotKeyEvents();
+ }
+ }
+
+ @Test
+ public void testFirstPair() {
+ testPair(KeyEvent.VK_CONTROL, KeyEvent.VK_X, "hotkey 1");
+ }
+
+ @Test
+ public void testSecondPair() {
+ testPair(KeyEvent.VK_ALT, KeyEvent.VK_X, "hotkey 2");
+ }
+
+ private void checkEvent(String text, int number) {
+ waitGui
+ .failWith("The number of hotkey events doesn't match. Found <" + selenium.getCount(pjq(format(hotKeyEeventLocator, text))) + ">, expected <" + number + ">.")
+ .until(countEquals.locator(pjq(format(hotKeyEeventLocator, text))).count(number));
+ }
+
+ private void clearHotKeyEvents() {
+ selenium.click(clearButton);
+ waitGui.until(NegationCondition.getInstance().condition(elementPresent.locator(pjq(format(hotKeyEeventLocator, "''")))));
+ }
+
+ private void testPair(int firstKey, int secondKey, String text) {
+ selenium.focus(firstInput);
+ for (int i=1; i<=NUMBER_OF_TESTS; i++) {
+ for (int j=0; j<i; j++) {
+ selenium.keyPressNative(String.valueOf(firstKey));
+ selenium.keyPressNative(String.valueOf(secondKey));
+ selenium.keyDownNative(String.valueOf(firstKey));
+ selenium.keyPressNative(String.valueOf(secondKey));
+ selenium.keyUpNative(String.valueOf(firstKey));
+ }
+ checkEvent(text, i);
+ checkEvent("''", i);
+ clearHotKeyEvents();
+ }
+ }
+
+}
12 years, 11 months
JBoss Rich Faces SVN: r23125 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2012-01-04 09:35:01 -0500 (Wed, 04 Jan 2012)
New Revision: 23125
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreePhases.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSelection.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSimple.java
Log:
failing tests put to group 4.2
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreePhases.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreePhases.java 2012-01-04 12:24:22 UTC (rev 23124)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreePhases.java 2012-01-04 14:35:01 UTC (rev 23125)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -26,6 +26,7 @@
import javax.faces.event.PhaseId;
import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.richfaces.tests.metamer.ftest.annotations.Use;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -47,6 +48,7 @@
}
@Test
+ @Use(field = "sample", strings = { "simpleSwingTreeNode", "simpleRichFacesTreeDataModel" })
public void testPhasesSelection() {
tree.getNode(4).expand();
tree.getNode(4).getNode(3).select();
@@ -54,6 +56,13 @@
phaseInfo.assertListener(PhaseId.APPLY_REQUEST_VALUES, "selection change listener invoked");
}
+ @Test(groups = { "4.2" })
+ @IssueTracking("https://issues.jboss.org/browse/RF-11766")
+ @Use(field = "sample", strings = { "simpleRichFacesTreeNode" })
+ public void testPhasesSelectionWithSimpleTreeNode() {
+ testPhasesSelection();
+ }
+
@Test
public void testPhasesToggling() {
tree.getNode(2).expand();
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSelection.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSelection.java 2012-01-04 12:24:22 UTC (rev 23124)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSelection.java 2012-01-04 14:35:01 UTC (rev 23125)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -36,9 +36,8 @@
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.utils.text.SimplifiedFormat;
import org.richfaces.component.SwitchType;
-import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.richfaces.tests.metamer.ftest.annotations.Use;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -48,31 +47,22 @@
@Use(field = "selectionPaths", value = "")
public class TestTreeSelection extends AbstractTestTree {
- protected Integer[][] selectionPaths = new Integer[][] {{4, 3}, {1, 4}, {2, 1, 1}, {2}, {2, 1},
- {3, 5 }, {4, 10, 3 } };
-
+ protected Integer[][] selectionPaths = new Integer[][] { { 4, 3 }, { 2, 1, 1 }, { 2 }, { 4, 10, 3 } };
+
protected TreeModel tree = new TreeModel(pjq("div.rf-tr[id$=richTree]"));
protected TreeNodeModel treeNode;
- @Inject
- @Use(value = "selectionTypes")
- SwitchType selectionType;
- SwitchType[] selectionTypes = new SwitchType[] {SwitchType.ajax, SwitchType.client};
- SwitchType[] eventEnabledSelectionTypes = new SwitchType[] {SwitchType.ajax};
-
JQueryLocator expandAll = jq("input:submit[id$=expandAll]");
JQueryLocator selection = jq("span[id$=selection]");
JQueryLocator clientId = jq("span[id$=selectionEventClientId]");
JQueryLocator newSelection = jq("span[id$=selectionEventNewSelection]");
JQueryLocator oldSelection = jq("span[id$=selectionEventOldSelection]");
- @BeforeMethod
- public void testInitialize() {
+ public void testInitialize(SwitchType selectionType) {
treeAttributes.set(TreeAttributes.selectionType, selectionType);
tree.setSelectionType(selectionType);
}
- @Test
public void testTopLevelSelection() {
assertEquals(tree.getAnySelectedNodesCount(), 0);
@@ -88,6 +78,26 @@
}
@Test
+ public void testTopLevelSelectionClient() {
+ testInitialize(SwitchType.client);
+ testTopLevelSelection();
+ }
+
+ @Test
+ @Use(field = "sample", strings = { "simpleSwingTreeNode", "simpleRichFacesTreeDataModel" })
+ public void testTopLevelSelectionAjax() {
+ testInitialize(SwitchType.ajax);
+ testTopLevelSelection();
+ }
+
+ @Test(groups = { "4.2" })
+ @IssueTracking("https://issues.jboss.org/browse/RF-11766")
+ @Use(field = "sample", strings = { "simpleRichFacesTreeNode" })
+ public void testTopLevelSelectionAjaxWithSimpleTreeNode() {
+ testInitialize(SwitchType.ajax);
+ testTopLevelSelection();
+ }
+
public void testSubNodesSelection() {
expandAll();
assertEquals(tree.getAnySelectedNodesCount(), 0);
@@ -105,7 +115,26 @@
}
@Test
- @Use(field = "selectionType", value = "eventEnabledSelectionTypes")
+ public void testSubNodesSelectionClient() {
+ testInitialize(SwitchType.client);
+ testSubNodesSelection();
+ }
+
+ @Test
+ @Use(field = "sample", strings = { "simpleSwingTreeNode", "simpleRichFacesTreeDataModel" })
+ public void testSubNodesSelectionAjax() {
+ testInitialize(SwitchType.ajax);
+ testSubNodesSelection();
+ }
+
+ @Test(groups = { "4.2" })
+ @IssueTracking("https://issues.jboss.org/browse/RF-11766")
+ @Use(field = "sample", strings = { "simpleRichFacesTreeNode" })
+ public void testSubNodesSelectionAjaxWithSimpleTreeNode() {
+ testInitialize(SwitchType.ajax);
+ testSubNodesSelection();
+ }
+
public void testSubNodesSelectionEvents() {
expandAll();
Integer[] old = null;
@@ -139,6 +168,28 @@
}
}
+ @Test(groups = { "4.2" })
+ @IssueTracking("https://issues.jboss.org/browse/RF-11766")
+ public void testSubNodesSelectionEventsClient() {
+ testInitialize(SwitchType.client);
+ testSubNodesSelectionEvents();
+ }
+
+ @Test
+ @Use(field = "sample", strings = { "simpleSwingTreeNode", "simpleRichFacesTreeDataModel" })
+ public void testSubNodesSelectionEventsAjax() {
+ testInitialize(SwitchType.ajax);
+ testSubNodesSelectionEvents();
+ }
+
+ @Test(groups = { "4.2" })
+ @IssueTracking("https://issues.jboss.org/browse/RF-11766")
+ @Use(field = "sample", strings = { "simpleRichFacesTreeNode" })
+ public void testSubNodesSelectionEventsAjaxWithSimpleTreeNode() {
+ testInitialize(SwitchType.ajax);
+ testSubNodesSelectionEvents();
+ }
+
protected void expandAll() {
guardXhr(selenium).click(expandAll);
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSimple.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSimple.java 2012-01-04 12:24:22 UTC (rev 23124)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTree/TestTreeSimple.java 2012-01-04 14:35:01 UTC (rev 23125)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -243,6 +243,7 @@
}
@Test
+ @Use(field = "sample", strings = { "simpleSwingTreeNode", "simpleRichFacesTreeDataModel" })
@Templates(exclude = "a4jRegion")
public void testSelectionClientSideEvents() {
String[] events = new String[] { "beforeselectionchange", "begin", "beforedomupdate", "complete",
@@ -252,6 +253,14 @@
testRequestEventsAfter(events);
}
+ @Test(groups = { "4.2" })
+ @IssueTracking("https://issues.jboss.org/browse/RF-11766")
+ @Use(field = "sample", strings = { "simpleRichFacesTreeNode" })
+ @Templates(exclude = "a4jRegion")
+ public void testSelectionClientSideEventsWithSimpleTreeNode() {
+ testSelectionClientSideEvents();
+ }
+
@Test(groups = { "4.Future" })
@IssueTracking("https://issues.jboss.org/browse/RF-11319")
@Templates(value = "a4jRegion")
12 years, 11 months
JBoss Rich Faces SVN: r23124 - modules/tests/metamer/branches.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2012-01-04 07:24:22 -0500 (Wed, 04 Jan 2012)
New Revision: 23124
Added:
modules/tests/metamer/branches/contextMenu/
Log:
RF-10197: Create initial feature branch for contextMenu in Metamer
12 years, 11 months
JBoss Rich Faces SVN: r23123 - modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2012-01-04 07:15:02 -0500 (Wed, 04 Jan 2012)
New Revision: 23123
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichTreeBean.java
Log:
code refactored
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichTreeBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichTreeBean.java 2012-01-04 11:25:38 UTC (rev 23122)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichTreeBean.java 2012-01-04 12:15:02 UTC (rev 23123)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2012, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -145,10 +145,10 @@
public RichFacesTreeNode<Labeled> getRichFacesTreeNodeRoot() {
if (richfacesTreeNodeRoot == null) {
- List<RichFacesTreeNode<Labeled>> richfacesTreeNodeList = (List<RichFacesTreeNode<Labeled>>) (List<?>) buldTree(RichFacesTreeNode.createFactory());
+ List<RichFacesTreeNode<Labeled>> richfacesTreeNodeList = (List<RichFacesTreeNode<Labeled>>) (List<?>) buildTree(RichFacesTreeNode.createFactory());
richfacesTreeNodeRoot = new RichFacesTreeNode<Labeled>();
int i=0;
- for (RichFacesTreeNode node : richfacesTreeNodeList) {
+ for (RichFacesTreeNode<?> node : richfacesTreeNodeList) {
richfacesTreeNodeRoot.addChild(i, node);
i++;
}
@@ -158,8 +158,8 @@
public List<SwingTreeNode<Labeled>> getSwingTreeNodeRoot() {
if (swingTreeNodeRoot == null) {
- List<SwingTreeNode<Labeled>> swingTreeNodelist = (List<SwingTreeNode<Labeled>>) (List<?>) buldTree(SwingTreeNode.createFactory());
- swingTreeNodeRoot = swingTreeNodelist;
+ List<SwingTreeNode<Labeled>> swingTreeNodeList = (List<SwingTreeNode<Labeled>>) (List<?>) buildTree(SwingTreeNode.createFactory());
+ swingTreeNodeRoot = swingTreeNodeList;
}
return swingTreeNodeRoot;
}
@@ -214,7 +214,7 @@
}
}
- private List<TreeNodeWithContent<Labeled>> buldTree(TreeNodeWithContentFactory<TreeNodeWithContent<Labeled>> treeNodeFactory) {
+ private List<TreeNodeWithContent<Labeled>> buildTree(TreeNodeWithContentFactory<TreeNodeWithContent<Labeled>> treeNodeFactory) {
List<TreeNodeWithContent<Labeled>> firstLevelNodes = new ArrayList<TreeNodeWithContent<Labeled>>();
for(State state : companiesCache.keySet()) {
TreeNodeWithContent<Labeled> stateTreeNode = treeNodeFactory.createTreeNode(null, state);
12 years, 11 months