myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1759966 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src: main/webapp/content/40-test/4000-button+link/ test/java/org/apache/myfaces/tobago/example/demo/
Date Fri, 09 Sep 2016 09:34:34 GMT
Author: lofwyr
Date: Fri Sep  9 09:34:33 2016
New Revision: 1759966

URL: http://svn.apache.org/viewvc?rev=1759966&view=rev
Log:
TOBAGO 1544: Demo
[developed by hnoeth]

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/x-link.xhtml
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/button+link.test.js
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/button+link.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/x-action.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/x-resource.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/webapp/content/40-test/4000-button+link/button+link.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button%2Blink/button%2Blink.test.js?rev=1759966&r1=1759965&r2=1759966&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/button+link.test.js
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/button+link.test.js
Fri Sep  9 09:34:33 2016
@@ -15,15 +15,83 @@
  * limitations under the License.
  */
 
-QUnit.test("Standard Action Link", function (assert) {
+QUnit.test("Standard Action Button", function(assert) {
+  assert.expect(2);
+  var done = assert.async(2);
+
+  var $command = jQueryFrame("#page\\:mainForm\\:standardButtonAction");
+  var $destinationSection = jQueryFrame("#page\\:actionSection");
+  testStandardCommands($command, $destinationSection, assert, done);
+});
+
+QUnit.test("Standard Link Button", function(assert) {
+  assert.expect(2);
+  var done = assert.async(2);
+
+  var $command = jQueryFrame("#page\\:mainForm\\:standardButtonLink");
+  var $destinationSection = jQueryFrame("#page\\:linkSection");
+  testStandardCommands($command, $destinationSection, assert, done);
+});
+
+/*QUnit.test("Standard Resource Button", function(assert) {
+  assert.expect(2);
+  var done = assert.async(2);
+
+  var $command = jQueryFrame("#page\\:mainForm\\:standardButtonResource");
+  var $destinationSection = jQueryFrame("#page\\:resourceSection");
+  testStandardCommands($command, $destinationSection, assert, done);
+});*/
+
+QUnit.test("Standard Action Link", function(assert) {
+  assert.expect(2);
+  var done = assert.async(2);
+
   var $command = jQueryFrame("#page\\:mainForm\\:standardLinkAction");
+  var $destinationSection = jQueryFrame("#page\\:actionSection");
+  testStandardCommands($command, $destinationSection, assert, done);
+});
+
+QUnit.test("Standard Link Link", function(assert) {
+  assert.expect(2);
+  var done = assert.async(2);
+
+  var $command = jQueryFrame("#page\\:mainForm\\:standardLinkLink");
+  var $destinationSection = jQueryFrame("#page\\:linkSection");
+  testStandardCommands($command, $destinationSection, assert, done);
+});
+
+/*QUnit.test("Standard Resource Link", function(assert) {
+  assert.expect(2);
+  var done = assert.async(2);
 
-  // do something
+  var $command = jQueryFrame("#page\\:mainForm\\:standardLinkResource");
+  var $destinationSection = jQueryFrame("#page\\:resourceSection");
+  testStandardCommands($command, $destinationSection, assert, done);
+});*/
 
-  jQuery("#page\\:testframe").load(function () {
+function testStandardCommands($command, $destinationSection, assert, done) {
+  var step = 1;
+  $command[0].click();
 
-    // do something
+  jQuery("#page\\:testframe").load(function() {
+    if (step == 1) {
+      $destinationSection = jQueryFrame($destinationSection.selector);
+      assert.equal($destinationSection.length, 1);
 
+      var $back = jQueryFrame("#page\\:back");
+      $back[0].click();
+    } else if (step == 2) {
+      $command = jQueryFrame($command.selector);
+      assert.equal($command.length, 1);
+    }
+    step++;
     done();
   });
-});
+}
+
+// TODO: Test Confirmation: Mock Alerts with sinon
+
+
+function jQueryTargetFrame(expression) {
+  return document.getElementById("page:testframe").contentWindow.jQuery(expression);
+}

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/button+link.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button%2Blink/button%2Blink.xhtml?rev=1759966&r1=1759965&r2=1759966&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/button+link.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/button+link.xhtml
Fri Sep  9 09:34:33 2016
@@ -21,78 +21,107 @@
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:f="http://java.sun.com/jsf/core">
   <ui:param name="title" value="#{overviewBundle.button_link}"/>
+
   <tc:section label="Standard">
-    <tc:link id="standardLinkAction" label="Action" action="#{buttonLinkController.actionPage}"/>
-    | <tc:link id="standardLinkOnClick" label="OnClick" disabled="true" link="https://www.apache.org/"/>
-    | <tc:link id="standardLinkLink" label="Link" link="https://www.apache.org/"/>
-    | <tc:link id="standardLinkResource" label="Resource"
-               resource="faces/content/40-test/4000-button+link/x-resource.xhtml"/>
-    <br/>
-    <tc:button id="standardButtonAction" label="Action" action="#{buttonLinkController.actionPage}"/>
-    <tc:button id="standardButtonOnClick" label="OnClick" disabled="true" link="https://www.apache.org/"/>
-    <tc:button id="standardButtonLink" label="Link" link="https://www.apache.org/"/>
-    <tc:button id="standardButtonResource" label="Resource"
-               resource="faces/content/40-test/4000-button+link/x-resource.xhtml"/>
+    <tc:buttons>
+      <tc:button id="standardButtonAction" label="Action" action="#{buttonLinkController.actionPage}"/>
+      <tc:button id="standardButtonLink" label="Link" link="x-link.xhtml"/>
+      <tc:button id="standardButtonResource" label="Resource"
+                 resource="content/40-test/4000-button+link/x-resource.xhtml"/>
+    </tc:buttons>
+    <tc:commands>
+      <tc:link id="standardLinkAction" label="Action" action="#{buttonLinkController.actionPage}"/>
+      <tc:link id="standardLinkLink" label="Link" link="x-link.xhtml"/>
+      <tc:link id="standardLinkResource" label="Resource" resource="content/40-test/4000-button+link/x-resource.xhtml"/>
+    </tc:commands>
+    <br/>
+    <br/>
   </tc:section>
+
   <tc:section label="Confirmation">
-    <tc:link id="confirmationLinkAction" label="Action" action="#{buttonLinkController.actionPage}">
-      <f:facet name="confirmation">
-        <tc:out value="Are you sure?"/>
-      </f:facet>
-    </tc:link>
-    | <tc:link id="confirmationLinkOnClick" label="OnClick" disabled="true" link="https://www.apache.org/">
-    <f:facet name="confirmation">
-      <tc:out value="Are you sure?"/>
-    </f:facet>
-  </tc:link>
-    | <tc:link id="confirmationLinkLink" label="Link" link="https://www.apache.org/">
-    <f:facet name="confirmation">
-      <tc:out value="Are you sure?"/>
-    </f:facet>
-  </tc:link>
-    | <tc:link id="confirmationLinkResource" label="Resource"
+    <tc:buttons>
+      <tc:button id="confirmationButtonAction" label="Action" action="#{buttonLinkController.actionPage}">
+        <f:facet name="confirmation">
+          <tc:out value="Are you sure?"/>
+        </f:facet>
+      </tc:button>
+      <tc:button id="confirmationButtonLink" label="Link" link="x-link.xhtml">
+        <f:facet name="confirmation">
+          <tc:out value="Are you sure?"/>
+        </f:facet>
+      </tc:button>
+      <tc:button id="confirmationButtonResource" label="Resource"
+                 resource="faces/content/40-test/4000-button+link/x-resource.xhtml">
+        <f:facet name="confirmation">
+          <tc:out value="Are you sure?"/>
+        </f:facet>
+      </tc:button>
+    </tc:buttons>
+    <tc:commands>
+      <tc:link id="confirmationLinkAction" label="Action" action="#{buttonLinkController.actionPage}">
+        <f:facet name="confirmation">
+          <tc:out value="Are you sure?"/>
+        </f:facet>
+      </tc:link>
+      <tc:link id="confirmationLinkLink" label="Link" link="x-link.xhtml">
+        <f:facet name="confirmation">
+          <tc:out value="Are you sure?"/>
+        </f:facet>
+      </tc:link>
+      <tc:link id="confirmationLinkResource" label="Resource"
                resource="faces/content/40-test/4000-button+link/x-resource.xhtml">
-    <f:facet name="confirmation">
-      <tc:out value="Are you sure?"/>
-    </f:facet>
-  </tc:link>
+        <f:facet name="confirmation">
+          <tc:out value="Are you sure?"/>
+        </f:facet>
+      </tc:link>
+    </tc:commands>
     <br/>
-    <tc:button id="confirmationButtonAction" label="Action" action="#{buttonLinkController.actionPage}">
-      <f:facet name="confirmation">
-        <tc:out value="Are you sure?"/>
-      </f:facet>
-    </tc:button>
-    <tc:button id="confirmationButtonOnClick" label="OnClick" disabled="true" link="https://www.apache.org/">
-      <f:facet name="confirmation">
-        <tc:out value="Are you sure?"/>
-      </f:facet>
-    </tc:button>
-    <tc:button id="confirmationButtonLink" label="Link" link="https://www.apache.org/">
+    <br/>
+  </tc:section>
+
+  <tc:section label="Target">
+    <tc:buttons>
+      <tc:button id="targetButtonAction" label="Action" actions="#{buttonLinkController.actionPage}"
+                 target="targetFrame"/>
+      <tc:button id="targetButtonLink" label="Link" link="x-link.xhtml" target="targetFrame"/>
+      <tc:button id="targetButtonResource" label="Resource"
+                 resource="content/40-test/4000-button+link/x-resource.xhtml"
+                 target="targetFrame"/>
+    </tc:buttons>
+    <tc:commands>
+      <tc:link id="targetLinkAction" label="Action" action="#{buttonLinkController.actionPage}"
target="targetFrame"/>
+      <tc:link id="targetLinkLink" label="Link" link="x-link.xhtml" target="targetFrame"/>
+      <tc:link id="targetLinkResource" label="Resource"
+               resource="content/40-test/4000-button+link/x-resource.xhtml"
+               target="targetFrame"/>
+    </tc:commands>
+    <br/>
+    <br/>
+    <tc:object id="targetFrame" name="targetFrame">
+      <tc:style width="100%" height="150px"/>
+    </tc:object>
+  </tc:section>
+
+  <tc:section label="Resource + Language">
+    <p>Resource should lead to different HTMLs based on the current language.</p>
+  </tc:section>
+
+  <tc:section label="JavaScript">
+    <p>Execute JavaScript on click.</p>
+    <tc:link label="JavaScript"/>
+    <tc:button label="JavaScript"/>
+
+    |
+    <tc:link label="OnClick Confirm" disabled="true" link="x-link.xhtml">
       <f:facet name="confirmation">
         <tc:out value="Are you sure?"/>
       </f:facet>
-    </tc:button>
-    <tc:button id="confirmationButtonResource" label="Resource"
-               resource="faces/content/40-test/4000-button+link/x-resource.xhtml">
+    </tc:link>
+    <tc:button label="OnClick Confirm" disabled="true" link="x-link.xhtml">
       <f:facet name="confirmation">
         <tc:out value="Are you sure?"/>
       </f:facet>
     </tc:button>
-  </tc:section>
-  <tc:section label="Target">
-    <tc:link id="targetLinkAction" label="Action" action="#{buttonLinkController.actionPage}"
target="_blank"/>
-    | <tc:link id="targetLinkOnClick" label="OnClick" disabled="true" link="https://www.apache.org/"
target="_blank"/>
-    | <tc:link id="targetLinkLink" label="Link" link="https://www.apache.org/" target="_blank"/>
-    | <tc:link id="targetLinkResource" label="Resource"
-               resource="faces/content/40-test/4000-button+link/x-resource.xhtml"
-               target="_blank"/>
-    <br/>
-    <tc:button id="targetButtonAction" label="Action" action="#{buttonLinkController.actionPage}"
target="_blank"/>
-    <tc:button id="targetButtonOnClick" label="OnClick" disabled="true" link="https://www.apache.org/"
-               target="_blank"/>
-    <tc:button id="targetButtonLink" label="Link" link="https://www.apache.org/" target="_blank"/>
-    <tc:button id="targetButtonResource" label="Resource"
-               resource="faces/content/40-test/4000-button+link/x-resource.xhtml"
-               target="_blank"/>
+    <p>target geht nicht</p>
   </tc:section>
 </ui:composition>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/x-action.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button%2Blink/x-action.xhtml?rev=1759966&r1=1759965&r2=1759966&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/x-action.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/x-action.xhtml
Fri Sep  9 09:34:33 2016
@@ -15,12 +15,13 @@
  * limitations under the License.
 -->
 
-<ui:composition template="/main.xhtml"
+<ui:composition template="/plain.xhtml"
                 xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:tc="http://myfaces.apache.org/tobago/component"
                 xmlns:ui="http://java.sun.com/jsf/facelets">
   <ui:param name="title" value="#{overviewBundle.button_link} &lt;tc:link> &lt;tc:button>"/>
-  <tc:section label="Action">
+  <tc:section id="actionSection" label="Action">
     <p>This page should be accessed by an link/button with <code>action</code>
attribute.</p>
+    <tc:button id="back" label="Back" link="button+link.xhtml"/>
   </tc:section>
 </ui:composition>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/x-link.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button%2Blink/x-link.xhtml?rev=1759966&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/x-link.xhtml
(added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/x-link.xhtml
Fri Sep  9 09:34:33 2016
@@ -0,0 +1,27 @@
+<!--
+ * 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="/plain.xhtml"
+                xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://java.sun.com/jsf/facelets">
+  <ui:param name="title" value="#{overviewBundle.button_link} &lt;tc:link> &lt;tc:button>"/>
+  <tc:section id="linkSection" label="Link">
+    <p>This page should be accessed by an link/button with <code>link</code>
attribute.</p>
+    <tc:button id="back" label="Back" link="button+link.xhtml"/>
+  </tc:section>
+</ui:composition>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/x-resource.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button%2Blink/x-resource.xhtml?rev=1759966&r1=1759965&r2=1759966&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/x-resource.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4000-button+link/x-resource.xhtml
Fri Sep  9 09:34:33 2016
@@ -15,12 +15,13 @@
  * limitations under the License.
 -->
 
-<ui:composition template="/main.xhtml"
+<ui:composition template="/plain.xhtml"
                 xmlns="http://www.w3.org/1999/xhtml"
-                xmlns:tc="http://myfaces.apache.org/tobago/component"
                 xmlns:ui="http://java.sun.com/jsf/facelets">
-  <ui:param name="title" value="#{overviewBundle.button_link} &lt;tc:link> &lt;tc:button>"/>
-  <tc:section label="Resource">
+  <script src="/org/apache/myfaces/tobago/renderkit/html/standard/standard/jquery/jquery-2.2.4.js"
+          type="text/javascript"/>
+  <div id="page:mainForm:resourceSection">
     <p>This page should be accessed by an link/button with <code>resource</code>
attribute.</p>
-  </tc:section>
+    <a id="page:mainForm:back" href="/faces/content/40-test/4000-button+link/button+link.xhtml">Back</a>
+  </div>
 </ui:composition>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/QUnitTests.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/QUnitTests.java?rev=1759966&r1=1759965&r2=1759966&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/QUnitTests.java
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/QUnitTests.java
Fri Sep  9 09:34:33 2016
@@ -356,6 +356,12 @@ public class QUnitTests {
   }
 
   @Test
+  public void testButtonLink() throws UnsupportedEncodingException, InterruptedException
{
+    String page = "content/40-test/4000-button+link/button+link.xhtml";
+    runStandardTest(page);
+  }
+
+  @Test
   public void rendererBaseGetCurrentValue() throws UnsupportedEncodingException, InterruptedException
{
     String page = "content/40-test/50000-java/10-rendererBase-getCurrentValue/rendererBase-getCurrentValue.xhtml";
     runStandardTest(page);



Mime
View raw message