[richfaces-svn-commits] JBoss Rich Faces SVN: r18868 - in modules/tests/metamer/trunk: ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery and 1 other directory.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Fri Aug 20 13:50:36 EDT 2010
Author: lfryc at redhat.com
Date: 2010-08-20 13:50:36 -0400 (Fri, 20 Aug 2010)
New Revision: 18868
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestSimple.java
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestTiming.java
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richJQuery/simple.xhtml
Log:
rich:jQuery - completed 6 tests for simple component sample (RFPL-668)
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richJQuery/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richJQuery/simple.xhtml 2010-08-20 17:49:37 UTC (rev 18867)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richJQuery/simple.xhtml 2010-08-20 17:50:36 UTC (rev 18868)
@@ -73,7 +73,7 @@
</ui:repeat>
</h:panelGroup>
- <rich:jQuery id="liveTestJQuery" selector="#liveTestGroup .liveTestComponent" attachType="live" event="click" query="alert(jQuery(this).text())" />
+ <rich:jQuery id="liveTestJQuery" selector="#liveTestGroup .liveTestComponent" attachType="live" event="click" query="alert(jQuery(this).text().trim())" />
<br/>
Copied: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestSimple.java (from rev 18867, modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestTiming.java)
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestSimple.java (rev 0)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestSimple.java 2010-08-20 17:50:36 UTC (rev 18868)
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.richJQuery;
+
+import static org.jboss.test.selenium.encapsulated.JavaScript.js;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.css.CssProperty;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.component.JQueryTiming;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc at redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestSimple extends AbstractMetamerTest {
+
+ JQueryLocator button = jq("#jQueryTestButton");
+ JQueryLocator rebind = jq("#rebindOneClickButton");
+ JQueryLocator addLiveComponent = jq("input[id$=addComponentButton]");
+ JQueryLocator liveTestComponent = jq("div.liveTestComponent");
+
+ RichJQueryAttributes attributes = new RichJQueryAttributes();
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richJQuery/simple.xhtml");
+ }
+
+ @Test
+ public void testDefaultTiming() {
+ setupDomReadyTypeAttributes();
+ attributes.setTiming(null);
+ assertEquals("red", selenium.getStyle(button, CssProperty.COLOR));
+ }
+
+ @Test
+ public void testTimingImmediate() {
+ setupImmediateTypeAttributes();
+ selenium.click(button);
+ waitGui.until(styleEquals.locator(button).property(CssProperty.COLOR).value("red"));
+ }
+
+ @Test
+ public void testTimingDomReady() {
+ setupDomReadyTypeAttributes();
+ assertEquals("red", selenium.getStyle(button, CssProperty.COLOR));
+ }
+
+ @Test
+ public void testAttachTypeOne() {
+ setupImmediateTypeAttributes();
+ attributes.setAttachType("one");
+ attributes.setQuery(js("alert('first')"));
+
+ selenium.click(button);
+ waitGui.until(alertEquals.message("first"));
+ selenium.click(button);
+ selenium.click(button);
+
+ for (int i = 0; i < 3; i++) {
+ selenium.click(rebind);
+ selenium.click(button);
+ waitGui.until(alertEquals.message("one attachType rebound event"));
+ }
+ }
+
+ @Test
+ public void testAttachTypeLive() {
+ for (int count = 1; count <= 4; count++) {
+ if (count > 1) {
+ selenium.click(addLiveComponent);
+ waitAjax.until(countEquals.locator(liveTestComponent).count(count));
+ }
+
+ for (int i = 1; i <= count; i++) {
+ JQueryLocator component = liveTestComponent.getNthOccurence(i);
+
+ String message = selenium.getText(component);
+ selenium.click(component);
+ waitGui.until(alertEquals.message(message));
+ }
+
+ }
+ }
+
+ private void setupImmediateTypeAttributes() {
+ attributes.setEvent("click");
+ attributes.setQuery(js("$(this).css('color', 'red')"));
+ attributes.setSelector(button);
+ attributes.setTiming(JQueryTiming.immediate);
+ }
+
+ private void setupDomReadyTypeAttributes() {
+ attributes.setEvent(null);
+ attributes.setQuery(js("css('color', 'red')"));
+ attributes.setSelector(button);
+ attributes.setTiming(JQueryTiming.domready);
+ }
+
+}
\ No newline at end of file
Deleted: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestTiming.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestTiming.java 2010-08-20 17:49:37 UTC (rev 18867)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richJQuery/TestTiming.java 2010-08-20 17:50:36 UTC (rev 18868)
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, 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.richJQuery;
-
-import static org.jboss.test.selenium.encapsulated.JavaScript.js;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.css.CssProperty;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.component.JQueryTiming;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.Test;
-
-/**
- * @author <a href="mailto:lfryc at redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class TestTiming extends AbstractMetamerTest {
-
- JQueryLocator button = jq("input:button[id$=jQueryTestButton]");
-
- RichJQueryAttributes attributes = new RichJQueryAttributes();
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/richJQuery/simple.xhtml");
- }
-
- private void setupImmediateTypeAttributes() {
- attributes.setEvent("click");
- attributes.setQuery(js("$(this).css('color', 'red')"));
- attributes.setSelector(button);
- attributes.setTiming(JQueryTiming.immediate);
- }
-
- private void setupDomReadyTypeAttributes() {
- attributes.setEvent(null);
- attributes.setQuery(js("css('color', 'red')"));
- attributes.setSelector(button);
- attributes.setTiming(JQueryTiming.domready);
- }
-
- @Test
- public void testImmediate() {
- setupImmediateTypeAttributes();
- selenium.click(button);
- waitGui.until(styleEquals.locator(button).property(CssProperty.COLOR).value("red"));
- }
-
- @Test
- public void testDomReady() {
- setupDomReadyTypeAttributes();
- assertEquals("red", selenium.getStyle(button, CssProperty.COLOR));
- }
-
- @Test
- public void testDomReadyByDefault() {
- setupDomReadyTypeAttributes();
- attributes.setTiming(null);
- assertEquals("red", selenium.getStyle(button, CssProperty.COLOR));
- }
-}
\ No newline at end of file
More information about the richfaces-svn-commits
mailing list