Merge branch 'master' of ssh://git.indexdata.com:222/home/git/private/mkws
authorMike Taylor <mike@indexdata.com>
Tue, 8 Jul 2014 12:46:53 +0000 (12:46 +0000)
committerMike Taylor <mike@indexdata.com>
Tue, 8 Jul 2014 12:46:53 +0000 (12:46 +0000)
examples/htdocs/jasmine-cors-popup.html
examples/htdocs/jasmine-local-popup.html
test/phantom/run-jasmine.js

index 57134ac..d7d1a7a 100644 (file)
@@ -3,6 +3,14 @@
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <title>MKWS demo: jQuery popup plugin with jasmine test framework</title>
 
+    <script type="text/javascript" src="//code.jquery.com/jquery-1.10.0.min.js"></script>
+    <script>
+      // create a function in external jquery object
+      $.extend({
+       mkws_external_jquery_object: function () { return true; }
+      });
+    </script>
+
     <script type="text/javascript" src="//mkws.indexdata.com/mkws-complete.js"></script>
     <link rel="stylesheet" type="text/css" href="//mkws.indexdata.com/mkws.css" />
 
     <script type="text/javascript" src="test/js/mkws-jasmine-run.js"></script>
     <script type="text/javascript"> mkws_jasmine_init(500); </script>
 
-    <!-- jquery null test 
-    <script type="text/javascript">$ = undefined;</script>
-       -->
-
     <style type="text/css">
       body > div > form > input.ui-state-default { background: none; }
     </style>
   </head>
 
   <body>
-    <script type="text/javascript">
+    <script>
+      // jquery.js from <head> section
+      if (!($.mkws_external_jquery_object && $.mkws_external_jquery_object())) {
+       alert("External jquery(1) mis-match!!!");
+      }
+      if (mkws.$.mkws_external_jquery_object && mkws.$.mkws_external_jquery_object()) {
+       alert("Internal jquery(1) mis-match!!!");
+      }
+    </script>
 
-    // using a local service proxy !!!
+    <script type="text/javascript">
     var mkws_config = {
       perpage_default: 10
     };
     var jasmine_config = {
       search_query: "netbsd",
       expected_hits: 10,
-      // active_clients: 17,
       check_motd: false,
       show_record_url: true
     };
-
-    jQuery.pazpar2({
-        "layout": "popup",               /* "table" [default], "div", "popup" */
-        "width": 990,                    /* popup width, should be at least 800 */
-        "height": 760                    /* popup height, should be at least 600 */
-    });
     </script>
 
-<h2>MKWS Jasmine regression tests</h2>
-<p/>
+    <h2>MKWS Jasmine regression tests</h2>
+
+      <div class="mkwsSwitch"></div>
+      <div class="mkwsLang"></div>
+      <div class="mkwsProgress"></div>
+      <div class="mkwsSearch"></div>
+      <div class="mkwsResults"></div>
+      <div class="mkwsTargets"></div>
+      <div class="mkwsStat"></div>
+      <div class="mkwsBuilder"></div>
+
+      <!-- include jquery again -->
+      <script type="text/javascript" src="//code.jquery.com/jquery-1.10.0.js"></script>
+      <script>
+       $(document).ready(function() {
+         // now the second jquery is used
+         if ($.mkws_external_jquery_object && $.mkws_external_jquery_object()) {
+           alert("External jquery(2) mis-match!!!");
+         }
+         if (mkws.$.mkws_external_jquery_object && mkws.$.mkws_external_jquery_object()) {
+           alert("Internal jquery(2) mis-match!!!");
+         }
 
+         // jquery null test
+         $ = undefined;
+         jQuery = undefined;
+
+         if (!mkws.$) {
+           alert("MKWS jquery(3) is not set!!!");
+         }
+
+       });
+      </script>
   </body>
 </html>
-
index 8ef34d6..3a85e82 100644 (file)
@@ -56,6 +56,7 @@
       expected_hits: 10,
       active_clients: 13,
       check_motd: false,
+      check_sortby: true,
       show_record_url: true
     };
 
index 27c465b..396417b 100644 (file)
@@ -108,14 +108,14 @@ page.open(url, function (status) {
 
     var exit = wait_for_jasmine(function () {
         return page.evaluate(function () {
-            if (!window || !window.$ || !window.mkws) {
+            if (!window || !window.mkws || !window.mkws.$) {
                 console.log("No window object found");
                 return false;
             }
 
-            var $ = window.$;
+            var $ = window.mkws.$;
             var error_msg = [""];
-            var passing = $(".passingAlert").text() || window.$(".failingAlert").text();
+            var passing = $(".passingAlert").text() || $(".failingAlert").text();
 
             // extract failed tests
             var list = $('.results > #details > .specDetail.failed');