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 2014/03/03 11:23:24 UTC

svn commit: r1573514 - in /myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp: script/tobago-assert.js test/attribute/mode-valueIfSet.js test/attribute/mode-valueIfSet.xhtml

Author: lofwyr
Date: Mon Mar  3 10:23:24 2014
New Revision: 1573514

URL: http://svn.apache.org/r1573514
Log:
TOBAGO-1373: Better JavaScript logging: using browser console and fill browser gaps.

Added:
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.js
      - copied, changed from r1573480, myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.xhtml
Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.xhtml

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js?rev=1573514&r1=1573513&r2=1573514&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js Mon Mar  3 10:23:24 2014
@@ -100,10 +100,9 @@ var TobagoAssert = {
 
   assertValue:function (elementOrId, expected) {
     var element = TobagoAssert.jQueryElement(elementOrId);
-    if (element.val() != expected) {
-      console.error("The value of element with id=" + element.attr('id')
-          + " is '" + element.val() + "', but expected was '" + expected + "'.");
-    }
+    console.assert(element.val() == expected,
+        "The value of element with id=" + element.attr('id')
+        + " is '" + element.val() + "', but expected was '" + expected + "'.");
   },
 
   assertContent:function (elementOrId, expected) {

Copied: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.js (from r1573480, myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.js?p2=myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.js&p1=myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.xhtml&r1=1573480&r2=1573514&rev=1573514&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.js Mon Mar  3 10:23:24 2014
@@ -1,5 +1,4 @@
-<?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.
@@ -14,118 +13,27 @@
  * 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.
--->
+ */
 
-<f:view
-    xmlns:tc="http://myfaces.apache.org/tobago/component"
-    xmlns:tx="http://myfaces.apache.org/tobago/extension"
-    xmlns:ui="http://java.sun.com/jsf/facelets"
-    xmlns:f="http://java.sun.com/jsf/core"
-    xmlns:c="http://java.sun.com/jsp/jstl/core">
+jQuery(document).ready(function () {
 
-  <tc:page id="page">
-    <f:facet name="layout">
-      <tc:gridLayout rows="auto"/>
-    </f:facet>
-    <tc:gridLayoutConstraint width="600px" height="600px"/>
+  // only to display
+  jQuery("#page\\:id-box").find("input").each(function () {
+    jQuery(this).val(jQuery(this).attr('id'));
+  });
+
+  // assertions
+  TobagoAssert.assertValue("page:direct", "direct literal");
+  TobagoAssert.assertValue("page:v1", "from var");
+  TobagoAssert.assertValue("page:v2", "from var");
+  TobagoAssert.assertValue("page:v3", "from var ++");
+  TobagoAssert.assertValue("page:v4", "value from model");
+  TobagoAssert.assertValue("page:vu", "");
 
-    <tc:label value="demo of the valueIfSet mode of tc:attribute (facelets only)"/>
-
-    <tc:box label="value">
-      <f:facet name="layout">
-        <tc:gridLayout rows="auto;auto;auto;auto;auto;auto;*" columns="250px;*"/>
-      </f:facet>
-
-      <tc:label value="value"/>
-      <tc:in id="direct">
-        <tc:attribute name="value" value="direct literal" mode="valueIfSet"/>
-      </tc:in>
-
-      <c:set var="value1" value="from var"/>
-      <tc:label value="value"/>
-      <tc:in id="v1">
-        <tc:attribute name="value" value="#{value1}" mode="valueIfSet"/>
-      </tc:in>
-
-      <c:set var="value2" value="#{value1}"/>
-      <tc:label value="value"/>
-      <tc:in id="v2">
-        <tc:attribute name="value" value="#{value2}" mode="valueIfSet"/>
-      </tc:in>
-
-      <c:set var="value3" value="#{value1} ++"/>
-      <tc:label value="value"/>
-      <tc:in id="v3">
-        <tc:attribute name="value" value="#{value3}" mode="valueIfSet"/>
-      </tc:in>
-
-      <c:set var="value4" value="#{attribute.value}"/>
-      <tc:label value="value"/>
-      <tc:in id="v4">
-        <tc:attribute name="value" value="#{value4}" mode="valueIfSet"/>
-      </tc:in>
-
-      <tc:label value="value (undefined)"/>
-      <tc:in id="vu">
-        <tc:attribute name="value" value="#{value_undefined}" mode="valueIfSet"/>
-      </tc:in>
-
-    </tc:box>
-
-    <tc:box label="id" id="id-box">
-      <f:facet name="layout">
-        <tc:gridLayout rows="auto;auto;auto;auto;auto;auto;*" columns="250px;*"/>
-      </f:facet>
-
-      <tc:label value="id"/>
-      <tc:in>
-        <tc:attribute name="id" value="my_number_1" mode="valueIfSet"/>
-      </tc:in>
-
-      <tc:label value="id (not implemented)"/>
-      <tc:in>
-        <tc:attribute name="id" value="#{'my_number_2'}" mode="valueIfSet"/>
-      </tc:in>
-
-      <c:set var="id3" value="my_number_3"/>
-      <tc:label value="id"/>
-      <tc:in>
-        <tc:attribute name="id" value="#{id3}" mode="valueIfSet"/>
-      </tc:in>
-
-      <tc:label value="id (undefined)"/>
-      <tc:in>
-        <tc:attribute name="id" value="#{id_undefined}" mode="valueIfSet"/>
-      </tc:in>
-
-    </tc:box>
-
-    <tc:script file="script/tobago-assert.js"/>
-    
-    <tc:script onload="check()">
-      function check() {
-
-        // only to display
-        jQuery("#page\\:id-box input").each(function() {
-          jQuery(this).val(jQuery(this).attr('id'));
-        });
-
-        // assertions
-        TobagoAssert.assertValue("page:direct", "direct literal");
-        TobagoAssert.assertValue("page:v1", "from var");
-        TobagoAssert.assertValue("page:v2", "from var");
-        TobagoAssert.assertValue("page:v3", "from var ++");
-        TobagoAssert.assertValue("page:v4", "value from model");
-        TobagoAssert.assertValue("page:vu", "");
-
-        var i1 = jQuery(Tobago.Utils.escapeClientId("page:id-box")).find("input:eq(0)");
-        TobagoAssert.assertAttribute(i1, "id", "page:my_number_1");
+  var i1 = jQuery(Tobago.Utils.escapeClientId("page:id-box")).find("input:eq(0)");
+  TobagoAssert.assertAttribute(i1, "id", "page:my_number_1");
 //        TobagoAssert.assertAttribute(..., "id", "");
-        var i3 = jQuery(Tobago.Utils.escapeClientId("page:id-box")).find("input:eq(2)");
-        TobagoAssert.assertAttribute(i3, "id", "page:my_number_3");
+  var i3 = jQuery(Tobago.Utils.escapeClientId("page:id-box")).find("input:eq(2)");
+  TobagoAssert.assertAttribute(i3, "id", "page:my_number_3");
 //        TobagoAssert.assertAttribute(..., "id", "");
-      }
-    </tc:script>
-
-  </tc:page>
-</f:view>
+});

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.xhtml?rev=1573514&r1=1573513&r2=1573514&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/attribute/mode-valueIfSet.xhtml Mon Mar  3 10:23:24 2014
@@ -101,31 +101,7 @@
     </tc:box>
 
     <tc:script file="script/tobago-assert.js"/>
-    
-    <tc:script onload="check()">
-      function check() {
-
-        // only to display
-        jQuery("#page\\:id-box input").each(function() {
-          jQuery(this).val(jQuery(this).attr('id'));
-        });
-
-        // assertions
-        TobagoAssert.assertValue("page:direct", "direct literal");
-        TobagoAssert.assertValue("page:v1", "from var");
-        TobagoAssert.assertValue("page:v2", "from var");
-        TobagoAssert.assertValue("page:v3", "from var ++");
-        TobagoAssert.assertValue("page:v4", "value from model");
-        TobagoAssert.assertValue("page:vu", "");
-
-        var i1 = jQuery(Tobago.Utils.escapeClientId("page:id-box")).find("input:eq(0)");
-        TobagoAssert.assertAttribute(i1, "id", "page:my_number_1");
-//        TobagoAssert.assertAttribute(..., "id", "");
-        var i3 = jQuery(Tobago.Utils.escapeClientId("page:id-box")).find("input:eq(2)");
-        TobagoAssert.assertAttribute(i3, "id", "page:my_number_3");
-//        TobagoAssert.assertAttribute(..., "id", "");
-      }
-    </tc:script>
+    <tc:script file="test/attribute/mode-valueIfSet.js"/>
 
   </tc:page>
 </f:view>