You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/06/10 13:54:01 UTC
svn commit: r1747709 [1/3] - in
/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src:
main/appended-resouces/META-INF/
main/java/org/apache/myfaces/tobago/example/demo/ main/webapp/
main/webapp/content/20-component/010-input/10-in/ main/webapp/...
Author: lofwyr
Date: Fri Jun 10 13:54:01 2016
New Revision: 1747709
URL: http://svn.apache.org/viewvc?rev=1747709&view=rev
Log:
TOBAGO-1473: Remove selenium legacy dependency
* QUnit tests: run by arquillian or manually
* currently problems with Firefox 47.0, 46.0 was okay
[developed by hnoeth]
Added:
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/date.test.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/date.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/qunit-1.23.1.js
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/style/qunit-1.23.1.css
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/test.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/QUnitTests.java
Modified:
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/appended-resouces/META-INF/LICENSE
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/appended-resouces/META-INF/NOTICE
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/ArquillianTest.java
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/appended-resouces/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/appended-resouces/META-INF/LICENSE?rev=1747709&r1=1747708&r2=1747709&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/appended-resouces/META-INF/LICENSE (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/appended-resouces/META-INF/LICENSE Fri Jun 10 13:54:01 2016
@@ -23,3 +23,29 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE F
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+
+------------------------------------------------------------------------------
+For QUnit:
+------------------------------------------------------------------------------
+
+The MIT License (MIT)
+
+Copyright (c)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/appended-resouces/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/appended-resouces/META-INF/NOTICE?rev=1747709&r1=1747708&r2=1747709&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/appended-resouces/META-INF/NOTICE (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/appended-resouces/META-INF/NOTICE Fri Jun 10 13:54:01 2016
@@ -4,3 +4,6 @@ Copyright 2002-2005 Atanion GmbH.
This product includes software developed by
Lea Verou http://lea.verou.me et al. (http://prismjs.com/)
+
+This product includes software developed by
+jQuery Foundation and other contributors (https://qunitjs.com/)
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java?rev=1747709&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java Fri Jun 10 13:54:01 2016
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.tobago.example.demo;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.enterprise.context.RequestScoped;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.inject.Named;
+import java.io.Serializable;
+import java.net.MalformedURLException;
+
+@RequestScoped
+@Named
+public class TestController implements Serializable {
+
+ private static final Logger LOG = LoggerFactory.getLogger(TestController.class);
+
+ public String getPage() {
+ final FacesContext facesContext = FacesContext.getCurrentInstance();
+ final ExternalContext externalContext = facesContext.getExternalContext();
+ final String viewId = facesContext.getViewRoot().getViewId();
+ final String testJs = viewId.substring(0, viewId.length() - 6) + ".test.js";
+ try {
+ if (externalContext.getResource(testJs) != null) {
+ return "/faces" + viewId;
+ }
+ } catch (MalformedURLException e) {
+ LOG.error("", e);
+ return "error";
+ }
+
+ return null;
+ }
+
+ public String getTestJs() {
+ final FacesContext facesContext = FacesContext.getCurrentInstance();
+ final ExternalContext externalContext = facesContext.getExternalContext();
+ final String viewId = facesContext.getViewRoot().getViewId();
+ final String testJs = viewId.substring(0, viewId.length() - 6) + ".test.js";
+ try {
+ if (externalContext.getResource(testJs) != null) {
+ return testJs.substring(1);
+ }
+ } catch (MalformedURLException e) {
+ LOG.error("", e);
+ return "error";
+ }
+
+ return null;
+ }
+}
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.test.js?rev=1747709&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.test.js Fri Jun 10 13:54:01 2016
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function jQueryFrame(expression){
+ return document.getElementById("page:testframe").contentWindow.jQuery(expression);
+}
+
+QUnit.test("inputfield with label", function (assert) {
+ var $label = jQueryFrame("#page\\:inormal > label");
+ var $inputField = jQueryFrame("#page\\:inormal\\:\\:field");
+
+ assert.equal($label.text(), "Input");
+ assert.equal($inputField.val(), "Some Text");
+
+ $inputField.val("abc");
+
+ var done = assert.async();
+ setTimeout(function () {
+ assert.equal($inputField.val(), "abc");
+ done();
+ }, 50);
+});
+
+QUnit.test("ajax change event", function (assert) {
+ var $inputField = jQueryFrame("#page\\:iajax\\:\\:field");
+ var $outputField = jQueryFrame("#page\\:oajax > span:first");
+
+ assert.equal($inputField.val(), "");
+ assert.equal($outputField.text(), "");
+
+ $inputField.val("qwe").trigger("change");
+ assert.equal($inputField.val(), "qwe");
+
+ var done = assert.async();
+ setTimeout(function () {
+ assert.equal(jQueryFrame("#page\\:oajax > span:first").text(), "qwe");
+ done();
+ }, 500);
+});
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.xhtml?rev=1747709&r1=1747708&r2=1747709&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/10-in/in.xhtml Fri Jun 10 13:54:01 2016
@@ -29,8 +29,8 @@
<p>In most cases, a label should be placed in front of every inputfield. Use the attribute
<code>label</code>.</p>
<pre><code class="language-markup"><tc:in label="Input" value="Some Text"/></code></pre>
- <tc:in id="i1" label="Input" value="Some Text"/>
- <tc:in id="i2" label="Read Only" readonly="true" value="Some Text"/>
+ <tc:in id="inormal" label="Input" value="Some Text"/>
+ <tc:in id="ireadonly" label="Read Only" readonly="true" value="Some Text"/>
<tc:in id="i3" label="Disabled" disabled="true" value="Some Text"/>
<tc:in id="i4" value="Input without a label"/>
</tc:section>
@@ -74,9 +74,9 @@
Additional, the <code>listener</code> attribute is set. The given method is called after the inputfield
loose focus.</p>
- <tc:in id="i8" label="On Change" value="#{inController.changeValue}">
- <f:ajax render="outputfield" listener="#{inController.update}"/>
+ <tc:in id="iajax" label="On Change" value="#{inController.changeValue}">
+ <f:ajax render="oajax" listener="#{inController.update}"/>
</tc:in>
- <tc:out id="outputfield" label="On Server" value="#{inController.changeValue}"/>
+ <tc:out id="oajax" label="On Server" value="#{inController.changeValue}"/>
</tc:section>
</ui:composition>
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.test.js?rev=1747709&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.test.js Fri Jun 10 13:54:01 2016
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+QUnit.test("suggest test", function (assert) {
+ assert.equal("not implemented", "not implemented yet");
+ // var $inputField = jQuery(document).find("#page\\:in\\:\\:field");
+ // var $outputField = jQuery(document).find("#page\\:out > span:first");
+ // var $button = jQuery(document).find("#page\\:button");
+
+ // assert.equal($inputField.val(), "");
+ // assert.equal($outputField.text(), "");
+ //
+ // $inputField.val("abc");
+ // assert.equal($inputField.val(), "abc");
+ // // assert.equal("123", "qwe");
+ // assert.equal($outputField.text(), "");
+ //
+ // $button.click();
+ // var done = assert.async();
+ // setTimeout(function () {
+ // assert.equal(content().find("#page\\:out > span:first").text(), "abc");
+ // done();
+ // }, 500);
+});
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.xhtml?rev=1747709&r1=1747708&r2=1747709&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/20-suggest/suggest.xhtml Fri Jun 10 13:54:01 2016
@@ -35,7 +35,7 @@
<pre><code class="language-markup"><tc:in label="Language" value="\#{suggestController.suggestInput}">
<tc:suggest suggestMethod="\#{suggestController.getInputSuggestItems}"/>
</tc:in></code></pre>
- <tc:in id="i1" label="Language" value="#{suggestController.suggestInput}">
+ <tc:in id="sugbasic" label="Language" value="#{suggestController.suggestInput}">
<tc:suggest suggestMethod="#{suggestController.getInputSuggestItems}"/>
</tc:in>
</tc:section>
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/date.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/date.test.js?rev=1747709&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/date.test.js (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/date.test.js Fri Jun 10 13:54:01 2016
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function jQueryFrame(expression) {
+ return document.getElementById("page:testframe").contentWindow.jQuery(expression);
+}
+
+QUnit.test("inputfield with label", function (assert) {
+ var $dateField = jQueryFrame("#page\\:dnopattern\\:\\:field");
+ var $dateButton = jQueryFrame("#page\\:dnopattern button");
+
+ assert.equal($dateField.val(), "");
+
+ $datepicker = jQueryFrame(".bootstrap-datetimepicker-widget");
+ assert.notOk($datepicker.get(0));
+
+ $dateButton.click();
+
+ $datepicker = jQueryFrame(".bootstrap-datetimepicker-widget");
+ assert.ok($datepicker.get(0));
+
+ assert.notEqual($dateField.val(), "");
+});
Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/date.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/date.xhtml?rev=1747709&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/date.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/1040-date/date.xhtml Fri Jun 10 13:54:01 2016
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+
+<ui:composition template="/main.xhtml"
+ xmlns:tc="http://myfaces.apache.org/tobago/component"
+ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://myfaces.apache.org/tobago/component ">
+ <ui:param name="title" value="#{overviewBundle.date}"/>
+
+ <tc:date id="dnopattern">
+
+ </tc:date>
+ <tc:button label="Submit"/>
+
+
+</ui:composition>
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml?rev=1747709&r1=1747708&r2=1747709&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml Fri Jun 10 13:54:01 2016
@@ -114,7 +114,7 @@
</tc:button>
</tc:form>
- <tc:form>
+ <tc:form id="navbtns">
<tc:button immediate="true" id="previous"
image="fa-angle-left"
action="#{navigationState.gotoPrevious}"
@@ -128,6 +128,13 @@
<tc:button action="#{navigationState.toggleViewSource}"
image="fa-code"
immediate="true" tip="#{overviewBundle.footer_viewSource}"/>
+ <tc:button id="runtest"
+ link="/faces/test.xhtml"
+ label="Run Test"
+ immediate="true" tip="Run Test">
+ <f:param name="page" value="#{testController.page}"/>
+ <f:param name="testjs" value="#{testController.testJs}"/>
+ </tc:button>
</tc:form>
</tc:flowLayout>