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 2017/03/08 09:43:59 UTC

svn commit: r1785939 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src: main/java/org/apache/myfaces/tobago/example/demo/ main/resources/org/apache/myfaces/tobago/example/demo/ main/webapp/ main/webapp/content/20-component/010-input/40-...

Author: lofwyr
Date: Wed Mar  8 09:43:59 2017
New Revision: 1785939

URL: http://svn.apache.org/viewvc?rev=1785939&view=rev
Log:
improve Demo
* fix a IE11 bug in the test for tc:date
* add a 'Test'-menu to start/close tests (the old start/close button is
removed)
* general visual improvements
* search in menu commented out
* fix sorting for sheet-filer.xhtml when another page in the sheet is
selected
* add behavior.xhtml, which explain f:ajax/tc:event
* image path corrected for upload.xhtml
* tc:button corrected for collapsible-panel.xhtml
[developed by hnoeth]

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/BehaviorController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/30-behavior/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/30-behavior/behavior.xhtml
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ExceptionController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetFilterController.java
    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/resources/org/apache/myfaces/tobago/example/demo/Demo.xml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.test.js
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/upload.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/20-collapsible-panel/collapsible-panel.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/menu.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/demo.js
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/test.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/testAll.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/QUnitTests.java

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/BehaviorController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/BehaviorController.java?rev=1785939&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/BehaviorController.java (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/BehaviorController.java Wed Mar  8 09:43:59 2017
@@ -0,0 +1,48 @@
+/*
+ * 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 javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+import java.io.Serializable;
+
+@RequestScoped
+@Named
+public class BehaviorController implements Serializable {
+
+  private String ajax;
+  private String event;
+
+  public String getAjax() {
+    return ajax;
+  }
+
+  public void setAjax(String ajax) {
+    this.ajax = ajax;
+  }
+
+  public String getEvent() {
+    return event;
+  }
+
+  public void setEvent(String event) {
+    this.event = event;
+  }
+}

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ExceptionController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ExceptionController.java?rev=1785939&r1=1785938&r2=1785939&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ExceptionController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ExceptionController.java Wed Mar  8 09:43:59 2017
@@ -35,7 +35,9 @@ public class ExceptionController impleme
             .getRequestMap().get("javax.servlet.error.exception");
     StringWriter stringWriter = new StringWriter();
     PrintWriter printWriter = new PrintWriter(stringWriter);
-    exception.printStackTrace(printWriter);
+    if(exception != null) {
+      exception.printStackTrace(printWriter);
+    }
     return stringWriter.toString();
   }
 }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetFilterController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetFilterController.java?rev=1785939&r1=1785938&r2=1785939&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetFilterController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetFilterController.java Wed Mar  8 09:43:59 2017
@@ -25,7 +25,7 @@ import org.apache.myfaces.tobago.model.S
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
@@ -38,7 +38,7 @@ import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
 
-@RequestScoped
+@SessionScoped
 @Named
 public class SheetFilterController extends SheetController implements Serializable {
 

Modified: 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=1785939&r1=1785938&r2=1785939&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TestController.java Wed Mar  8 09:43:59 2017
@@ -38,20 +38,21 @@ public class TestController implements S
 
   private static final Logger LOG = LoggerFactory.getLogger(TestController.class);
 
-  public String getTestBase() {
-    final FacesContext facesContext = FacesContext.getCurrentInstance();
-    final ExternalContext externalContext = facesContext.getExternalContext();
-    final String viewId = facesContext.getViewRoot().getViewId();
-    final String base = viewId.substring(0, viewId.length() - 6);
+  public boolean hasTest() {
+    final ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
+    final String testJsUrl = "/" + getBase() + ".test.js";
     try {
-      if (externalContext.getResource(base + ".test.js") != null) {
-        return base;
-      }
+      return externalContext.getResource(testJsUrl) != null;
     } catch (MalformedURLException e) {
-      LOG.error("viewId='" + viewId + "'", e);
+      LOG.error("URL was: " + testJsUrl, e);
     }
+    return false;
+  }
 
-    return null;
+  public String getBase() {
+    final FacesContext facesContext = FacesContext.getCurrentInstance();
+    final String viewId = facesContext.getViewRoot().getViewId();
+    return viewId.substring(1, viewId.length() - 6); //remove leading '/' and trailing '.xhtml'
   }
 
   public List<TestPage> getTestPages() {
@@ -59,10 +60,11 @@ public class TestController implements S
 
     int idCount = 1;
     final File rootDir = new File("src/main/webapp/content");
-    for (String testJs : getTestJs(rootDir)) {
-      final String xhtml = "/faces/" + testJs.substring(16, testJs.length() - 8) + ".xhtml";
-      final String adjustedTestJs = "/" + testJs.substring(16);
-      testPages.add(new TestPage("tp" + idCount++, xhtml, adjustedTestJs));
+    if (rootDir.exists()) {
+      for (String testJs : getTestJs(rootDir)) {
+        final String base = testJs.substring(16, testJs.length() - 8);
+        testPages.add(new TestPage("tp" + idCount++, base));
+      }
     }
     return testPages;
   }
@@ -81,25 +83,19 @@ public class TestController implements S
 
   public class TestPage {
     private final String id;
-    private final String xhtml;
-    private final String js;
+    private final String base;
 
-    TestPage(String id, String xhtml, String js) {
+    TestPage(String id, String base) {
       this.id = id;
-      this.xhtml = xhtml;
-      this.js = js;
+      this.base = base;
     }
 
     public String getId() {
       return id;
     }
 
-    public String getXhtml() {
-      return xhtml;
-    }
-
-    public String getJs() {
-      return js;
+    public String getBase() {
+      return base;
     }
   }
 }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml?rev=1785939&r1=1785938&r2=1785939&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml Wed Mar  8 09:43:59 2017
@@ -32,6 +32,10 @@
   <entry key="menu_locale">Language</entry>
   <entry key="menu_help">Help</entry>
   <entry key="menu_about">About</entry>
+  <entry key="menu_test">Test</entry>
+  <entry key="menu_runTest">Run Test</entry>
+  <entry key="menu_closeTest">Close Test</entry>
+  <entry key="menu_runTestAll">Run all tests</entry>
 
   <!-- navigate -->
   <entry key="intro">Intro</entry>
@@ -125,6 +129,7 @@
   <entry key="labeled_layout">LabeledLayout</entry>
   <entry key="format">Formatting</entry>
   <entry key="transition">Transition</entry>
+  <entry key="behavior">Behavior</entry>
   <entry key="for_each">For Each</entry>
   <entry key="collapsible">Collapsible</entry>
   <entry key="collapsible_box">Content Box</entry>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.test.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.test.js?rev=1785939&r1=1785938&r2=1785939&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.test.js (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/010-input/40-date/date.test.js Wed Mar  8 09:43:59 2017
@@ -42,6 +42,7 @@ QUnit.test("date with label", function (
   $dateButton.click();
 
   assert.equal($dateField.val(), today);
+  $dateButton.click(); // IE11: close datetimepicker for next test
 });
 
 QUnit.test("submit", function(assert) {

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/upload.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/upload.xhtml?rev=1785939&r1=1785938&r2=1785939&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/upload.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/upload.xhtml Wed Mar  8 09:43:59 2017
@@ -37,7 +37,7 @@
   <p>If using Servlet API 3.1 you may call <code>part.getSubmittedFileName()</code>, for 3.0 you may use the Utility
     <code>org.apache.myfaces.tobago.internal.util.PartUtils.getSubmittedFileName(part)</code>
     to access to filename of the upload.</p>
-  <tc:link label="Tag Library Documentation" image="image/feather-leaf.png"
+  <tc:link label="Tag Library Documentation" image="/image/feather-leaf.png"
            link="#{demoBundle.tagDocUrl}/#{info.stableVersion}/tld/tc/file.html"/>
 
   <tc:section id="s1" label="Basics">

Added: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/30-behavior/behavior.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/30-behavior/behavior.xhtml?rev=1785939&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/30-behavior/behavior.xhtml (added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/30-behavior/behavior.xhtml Wed Mar  8 09:43:59 2017
@@ -0,0 +1,70 @@
+<?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="http://www.w3.org/1999/xhtml"
+                xmlns:f="http://java.sun.com/jsf/core"
+                xmlns:tc="http://myfaces.apache.org/tobago/component"
+                xmlns:ui="http://java.sun.com/jsf/facelets">
+  <ui:param name="title" value="#{demoBundle.behavior}"/>
+  <p>There are two kinds of behaviors: </p>
+  <ul>
+    <li><code class="language-markup">&lt;f:ajax/></code> send an ajax request</li>
+    <li><code class="language-markup">&lt;tc:event/></code> do a full page reload</li>
+  </ul>
+  <p>You find more <tc:link label="examples" link="../../40-test/6000-event/event.xhtml"/> in the test section.</p>
+  <p>Tag Library Documentation:
+    <tc:link label="&lt;f:ajax/>" image="#{request.contextPath}/image/feather-leaf.png"
+             link="http://docs.oracle.com/javaee/6/javaserverfaces/2.1/docs/vdldocs/facelets/f/ajax.html"/>
+    |
+    <tc:link label="&lt;tc:event/>" image="#{request.contextPath}/image/feather-leaf.png"
+             link="#{demoBundle.tagDocUrl}/#{info.stableVersion}/tld/tc/event.html"/></p>
+
+  <tc:section label="Examples">
+    <p>Type a text into the input field. After leaving the input field, the given text is shown in the output field.</p>
+    <tc:section label="f:ajax">
+      <pre><code class="language-markup">&lt;tc:in label="Ajax Input" value="\#{behaviorController.ajax}">
+  &lt;f:ajax render="outAjax"/>
+&lt;/tc:in></code></pre>
+      <tc:in label="Ajax Input" value="#{behaviorController.ajax}">
+        <f:ajax render="outAjax"/>
+      </tc:in>
+      <tc:out id="outAjax" label="Ajax Output" value="#{behaviorController.ajax}"/>
+    </tc:section>
+
+    <tc:section label="tc:event">
+      <pre><code class="language-markup">&lt;tc:in label="Event Input" value="\#{behaviorController.event}">
+  &lt;tc:event/>
+&lt;/tc:in></code></pre>
+
+      <tc:in label="Event Input" value="#{behaviorController.event}">
+        <tc:event/>
+      </tc:in>
+      <tc:out label="Event Output" value="#{behaviorController.event}"/>
+    </tc:section>
+  </tc:section>
+
+  <tc:section label="Limitations">
+    <p>The <code class="language-markup">&lt;f:ajax></code> tag cannot inserted along with the
+      <code class="language-markup">&lt;tc:event></code> tag if both have the same <code>event</code> attribute value.
+      <br/>
+      The latter also applies if <code class="language-markup">&lt;f:ajax></code> is disabled
+      or if <code class="language-markup">&lt;tc:event></code> is not rendered.</p>
+  </tc:section>
+</ui:composition>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/20-collapsible-panel/collapsible-panel.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/20-collapsible-panel/collapsible-panel.xhtml?rev=1785939&r1=1785938&r2=1785939&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/20-collapsible-panel/collapsible-panel.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/53-collapsible/20-collapsible-panel/collapsible-panel.xhtml Wed Mar  8 09:43:59 2017
@@ -81,7 +81,7 @@
         <tc:button id="showClient" label="show" omit="true">
           <tc:operation name="show" for="clientPanel"/>
         </tc:button>
-        <tc:button id="hideClient" label="hide" omit="true" immediate="true">
+        <tc:button id="hideClient" label="hide" omit="true">
           <tc:operation name="hide" for="clientPanel"/>
         </tc:button>
       </tc:buttons>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml?rev=1785939&r1=1785938&r2=1785939&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml Wed Mar  8 09:43:59 2017
@@ -39,22 +39,23 @@
 
       <tc:segmentLayout large="#{tc:columnPartition(navigationState.viewSource ? '8;4' : '12')}">
 
-        <tc:flexLayout columns="*;4*">
+        <tc:flexLayout columns="auto;30px;*">
 
           <tc:panel>
             <ui:include src="/navigation.xhtml"/>
           </tc:panel>
+          <tc:panel/>
 
           <tc:flexLayout rows="auto;*">
 
             <tc:messages id="messages" orderBy="severity"
                          rendered="#{!navigationTree.outputPage and !navigationTree.messagesPage}"/>
 
-            <tc:box label="#{title}" id="content">
+            <tc:section label="#{title}" id="content">
               <tc:form id="mainForm">
                 <ui:insert/>
               </tc:form>
-            </tc:box>
+            </tc:section>
 
           </tc:flexLayout>
 

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=1785939&r1=1785938&r2=1785939&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 Wed Mar  8 09:43:59 2017
@@ -92,42 +92,44 @@
                         label="Requests: #{activityList.values[0].jsfRequest} / AJAX: #{activityList.values[0].ajaxRequest}"/>
           </tc:link>
 
+          <tc:link label="#{demoBundle.menu_test}" omit="true">
+            <tc:link id="runtest" label="#{demoBundle.menu_runTest}" link="/faces/test.xhtml"
+                     immediate="true" disabled="#{!testController.hasTest()}">
+              <f:param name="base" value="#{testController.base}"/>
+            </tc:link>
+            <tc:link id="closetest" label="#{demoBundle.menu_closeTest}" immediate="true"/>
+            <tc:link label="#{demoBundle.menu_runTestAll}" link="/faces/testAll.xhtml" target="_blank"
+                     immediate="true" rendered="#{facesContext.isProjectStage('Development')}"/>
+          </tc:link>
+
         </tc:links>
       </tc:form>
 
       <tc:flowLayout textAlign="right">
-        <tc:form inline="true">
+        <!--<tc:form inline="true">
           <tc:in placeholder="Search"/>
           <tc:button defaultCommand="true" omit="true" label="go">
             <tc:dataAttribute name="alert-text"
                               value="Sorry: Search not implemented"/>
 
           </tc:button>
-        </tc:form>
+        </tc:form>-->
         <tc:form id="navbtns" inline="true">
-          <tc:button immediate="true" id="previous"
-                     image="fa-angle-left"
-                     action="#{navigationState.gotoPrevious}"
-                     disabled="#{navigationState.first}"
-                     tip="#{demoBundle.footer_previous}"/>
-          <tc:button immediate="true" id="next"
-                     image="fa-angle-right"
-                     action="#{navigationState.gotoNext}"
-                     disabled="#{navigationState.last}"
-                     tip="#{demoBundle.footer_next}"/>
+          <tc:buttons>
+            <tc:button immediate="true" id="previous"
+                       image="fa-angle-left"
+                       action="#{navigationState.gotoPrevious}"
+                       disabled="#{navigationState.first}"
+                       tip="#{demoBundle.footer_previous}"/>
+            <tc:button immediate="true" id="next"
+                       image="fa-angle-right"
+                       action="#{navigationState.gotoNext}"
+                       disabled="#{navigationState.last}"
+                       tip="#{demoBundle.footer_next}"/>
+          </tc:buttons>
           <tc:button action="#{navigationState.toggleViewSource}"
                      image="fa-code"
                      immediate="true" tip="#{demoBundle.footer_viewSource}"/>
-          <tc:button id="runtest"
-                     link="/faces/test.xhtml"
-                     label="Run Test"
-                     immediate="true" tip="Run Test"
-                     rendered="#{testController.testBase != null}">
-            <f:param name="page" value="#{request.contextPath}/faces#{testController.testBase}.xhtml"/>
-            <f:param name="testjs" value="#{request.contextPath}#{testController.testBase}.test.js"/>
-          </tc:button>
-          <tc:button id="closetest" label="Close Test"
-                     immediate="true" tip="Close test window"/>
         </tc:form>
       </tc:flowLayout>
 

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/demo.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/demo.js?rev=1785939&r1=1785938&r2=1785939&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/demo.js (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/script/demo.js Wed Mar  8 09:43:59 2017
@@ -70,20 +70,20 @@ var initInspect = function (elements) {
 Tobago.registerListener(initInspect, Tobago.Phase.DOCUMENT_READY);
 Tobago.registerListener(initInspect, Tobago.Phase.AFTER_UPDATE);
 
-var initTestButtons = function () {
-  var $runButton = jQuery("#page\\:navbtns\\:runtest");
-  var $closeButton = jQuery("#page\\:navbtns\\:closetest");
+var initTestLinks = function () {
+  var $runLink = jQuery("#page\\:header\\:runtest");
+  var $closeLink = jQuery("#page\\:header\\:closetest");
 
   if (jQuery(parent.document.getElementById("qunit")).length) {
-    $runButton.hide();
-    $closeButton.attr("onclick", "window.top.location.href = location.href");
+    $runLink.hide();
+    $closeLink.attr("onclick", "window.top.location.href = location.href");
   } else {
-    $closeButton.hide();
+    $closeLink.hide();
   }
 };
 
-Tobago.registerListener(initTestButtons, Tobago.Phase.DOCUMENT_READY);
-Tobago.registerListener(initTestButtons, Tobago.Phase.AFTER_UPDATE);
+Tobago.registerListener(initTestLinks, Tobago.Phase.DOCUMENT_READY);
+Tobago.registerListener(initTestLinks, Tobago.Phase.AFTER_UPDATE);
 
 var initTestframe = function () {
   jQuery("#page\\:testframe").attr("onload", "this.height = this.contentWindow.jQuery('body').prop('scrollHeight');");

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/test.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/test.xhtml?rev=1785939&r1=1785938&r2=1785939&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/test.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/test.xhtml Wed Mar  8 09:43:59 2017
@@ -25,12 +25,12 @@
   <tc:script file="#{request.contextPath}/script/qunit-1.23.1.js"/>
   <tc:script file="#{request.contextPath}/script/tobago-test.js"/>
   <tc:style file="#{request.contextPath}/style/qunit-1.23.1.css"/>
-  <tc:script file="#{param['testjs']}"/>
+  <tc:script file="#{request.contextPath}/#{param['accessTest'] ? 'error/error' : param['base']}.test.js"/>
 
   <div id="qunit"></div>
   <div id="qunit-fixture"></div>
 
-  <tc:object id="testframe" src="#{param['page']}">
+  <tc:object id="testframe" src="#{request.contextPath}/faces/#{param['base']}.xhtml">
     <tc:style width="100%"/>
   </tc:object>
 </ui:composition>

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/testAll.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/testAll.xhtml?rev=1785939&r1=1785938&r2=1785939&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/testAll.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/testAll.xhtml Wed Mar  8 09:43:59 2017
@@ -25,6 +25,6 @@
   <tc:script file="#{request.contextPath}/script/tobago-testAll.js"/>
 
   <c:forEach items="#{testController.testPages}" var="testPage">
-    <tc:object id="#{testPage.id}" name="test.xhtml?page=#{testPage.xhtml}&amp;testjs=#{testPage.js}"/>
+    <tc:object id="#{testPage.id}" name="test.xhtml?base=#{testPage.base}"/>
   </c:forEach>
 </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=1785939&r1=1785938&r2=1785939&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 Wed Mar  8 09:43:59 2017
@@ -80,18 +80,18 @@ public class QUnitTests {
     return webArchive;
   }
 
-  private void setupBrowser(String page, String testJs) throws UnsupportedEncodingException {
-    LOG.info("setup browser for: " + page);
-    browser.get(contextPath + "/faces/test.xhtml?page=" + URLEncoder.encode(page, "UTF-8") + "&testjs="
-        + contextPath + URLEncoder.encode(testJs, "UTF-8"));
+  private void setupBrowser(String base, boolean accessTest) throws UnsupportedEncodingException {
+    LOG.info("setup browser for: " + base + ".xhtml | accessTest=" + accessTest);
+    browser.get(contextPath + "faces/test.xhtml?base=" + URLEncoder.encode(base, "UTF-8")
+        + (accessTest ? "&accessTest=true" : ""));
   }
 
   private void runStandardTest(String page) throws UnsupportedEncodingException, InterruptedException {
     testedPages.add(page);
 
     if (!ignorePages().contains(page)) {
-      String testJs = page.substring(0, page.length() - 6) + ".test.js";
-      setupBrowser(page, testJs);
+      final String base = page.substring(0, page.length() - 6);
+      setupBrowser(base, false);
 
       checkQUnitResults(page);
     }
@@ -126,7 +126,7 @@ public class QUnitTests {
             String message = assertion.findElement(By.className("test-message")).getText();
             String expected = assertion.findElement(By.className("test-expected")).getText();
             String actual = assertion.findElement(By.className("test-actual")).getText();
-            Assert.assertEquals(message, expected, actual);
+            Assert.assertEquals(message + " on page: " + page, expected, actual);
           }
         }
       } else if ("running".equals(testCase.getAttribute("class"))) {
@@ -194,24 +194,30 @@ public class QUnitTests {
   @Test
   public void testAccessAllPages() throws UnsupportedEncodingException, InterruptedException {
     List<String> pages = getXHTMLs();
-    String testJs = "error/error.test.js";
     List<WebElement> results;
 
     // Test if 'has no exception' test is correct.
-    setupBrowser("error/exception.xhtml", testJs);
+    setupBrowser("error/exception", true);
     results = qunit.findElement(By.id("qunit-tests")).findElements(By.xpath("li"));
-    Assert.assertEquals(results.get(0).getAttribute("class"), "fail");
-    Assert.assertEquals(results.get(1).getAttribute("class"), "pass");
+    for (WebElement result : results) {
+      if ("has no exception".equals(result.findElement(By.className("test-name")).getText())) {
+        Assert.assertEquals(result.getAttribute("class"), "fail");
+      }
+    }
 
     // Test if 'has no 404' test is correct.
-    setupBrowser("error/404.xhtml", testJs);
+    setupBrowser("error/404", true);
     results = qunit.findElement(By.id("qunit-tests")).findElements(By.xpath("li"));
-    Assert.assertEquals(results.get(0).getAttribute("class"), "pass");
-    Assert.assertEquals(results.get(1).getAttribute("class"), "fail");
+    for (WebElement result : results) {
+      if ("has no 404".equals(result.findElement(By.className("test-name")).getText())) {
+        Assert.assertEquals(result.getAttribute("class"), "fail");
+      }
+    }
 
     for (String page : pages) {
-      String pathForBrowser = page.substring(page.indexOf("src/main/webapp/") + "src/main/webapp/".length());
-      setupBrowser(pathForBrowser, testJs);
+      String pathForBrowser = page.substring(page.indexOf("src/main/webapp/") + "src/main/webapp/".length(),
+          page.length() - 6);
+      setupBrowser(pathForBrowser, true);
       checkQUnitResults(page);
     }
   }