myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1524303 - in /myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp: script/tobago-assert.js test/version/version.js test/version/version.xhtml
Date Wed, 18 Sep 2013 06:28:11 GMT
Author: lofwyr
Date: Wed Sep 18 06:28:11 2013
New Revision: 1524303

URL: http://svn.apache.org/r1524303
Log:
TOBAGO-1314: Version detection works not correctly for JSF 2.1
- auto test

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.js
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js?rev=1524303&r1=1524302&r2=1524303&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/script/tobago-assert.js
Wed Sep 18 06:28:11 2013
@@ -58,12 +58,18 @@ var TobagoAssert = {
   },
 
   fail: function(name, element, expected, actual) {
-    element.overlay({error: true, ajax: true});
-    var text = "The element '" + element.get(0).tagName + "' with id='" + element.attr("id")
-        + "' has wrong " + name + ": expected=" + expected + " actual=" + actual;
-    var overlay = element.data("tobago-overlay").overlay;
-    overlay.attr("title", (overlay.attr("title") === undefined ? "" : overlay.attr("title")+
"\n" ) + text);
-    LOG.error(text);
+    var text;
+    if (element) {
+      element.overlay({error: true, ajax: true});
+      text = "The element '" + element.get(0).tagName + "' with id='" + element.attr("id")
+          + "' has wrong " + name + ": expected=" + expected + " actual=" + actual;
+      var overlay = element.data("tobago-overlay").overlay;
+      overlay.attr("title", (overlay.attr("title") === undefined ? "" : overlay.attr("title")
+ "\n" ) + text);
+      LOG.error(text);
+    } else {
+      text = name + ": expected=" + expected + " actual=" + actual;
+      LOG.error(text);
+    }
   },
 
   assertLayout:function (elementOrId, left, top, width, height) {

Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.js?rev=1524303&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.js
(added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.js
Wed Sep 18 06:28:11 2013
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+TestVersion = {};
+
+TestVersion.init = function() {
+
+  var checked = jQuery("input[checked]");
+  if (checked.size() != 2) {
+    TobagoAssert.fail("2 field must be checked", null, 2, checked);
+  }
+
+  var version = checked.eq(0).next().html();
+  var packageVersion = "Version " + jQuery("input[type=text]").eq(0).val();
+
+  if (version != packageVersion) {
+    TobagoAssert.fail("Version number", null, version, packageVersion);
+  }
+
+  var impl = checked.eq(1).next().html();
+  var packageImpl = jQuery("input[type=text]").eq(1).val();
+
+  if (impl != packageImpl) {
+    TobagoAssert.fail("Implementation", null, version, packageVersion);
+  }
+};
+
+Tobago.registerListener(TestVersion.init, Tobago.Phase.DOCUMENT_READY);

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml?rev=1524303&r1=1524302&r2=1524303&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml
Wed Sep 18 06:28:11 2013
@@ -43,5 +43,8 @@
       <tx:in value="#{version.jsfTitle}" label="JSF Title"/>
     </tc:box>
 
+    <tc:script file="script/tobago-assert.js"/>
+    <tc:script file="test/version/version.js"/>
+
   </tc:page>
 </f:view>



Mime
View raw message