Merge branch 'master' of ssh://git.indexdata.com:222/home/git/private/mkws
authorWolfram Schneider <wosch@indexdata.dk>
Wed, 22 Jan 2014 13:00:34 +0000 (13:00 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Wed, 22 Jan 2014 13:00:34 +0000 (13:00 +0000)
examples/htdocs/jasmine-pp2.html
examples/htdocs/jasmine.html
test/spec/mkws-config.js
test/spec/mkws-pazpar2.js

index ea63cc7..c2ed5f0 100644 (file)
@@ -2,7 +2,6 @@
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <title>MKWS demo jasmine test framework</title>
-    <link rel="stylesheet" type="text/css" href="tools/htdocs/mkws.css" />
     <script type="text/javascript">
       var mkws_config = {
          use_service_proxy: false,
       };
 
       var jasmine_config = {
-       "show_record_url": false
+       "show_record_url": false // URLs not configured for pp2
       };
     </script>
-    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
+    <script type="text/javascript" src="//code.jquery.com/jquery-1.4.4.min.js"></script>
     <script type="text/javascript" src="tools/htdocs/pz2.js"></script>
     <script type="text/javascript" src="tools/htdocs/handlebars-v1.1.2.js"></script>
     <script type="text/javascript" src="tools/htdocs/jquery.json-2.4.js"></script>
     <script type="text/javascript" src="tools/htdocs/mkws.js"></script>
+
+    <link rel="stylesheet" type="text/css" href="tools/htdocs/mkws.css" />
     <style type="text/css">
       #mkwsTermlists div.facet {
       float:left;
index 95bc9ca..1f5ac7c 100644 (file)
@@ -5,14 +5,12 @@
     <link rel="stylesheet" type="text/css" href="tools/htdocs/mkws.css" />
     <script type="text/javascript">
       var mkws_config = {
+         pazpar2_url : "https://mkws.indexdata.com/service-proxy/",
+         service_proxy_auth: "https://mkws.indexdata.com/service-proxy-auth",
          perpage_default: 10
-         /*
-         pazpar2_url : "/service-proxy/",
-         service_proxy_auth : "/service-proxy-auth/",
-         */
       };
     </script>
-    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
+    <script type="text/javascript" src="//code.jquery.com/jquery-1.4.4.min.js"></script>
     <script type="text/javascript" src="tools/htdocs/pz2.js"></script>
     <script type="text/javascript" src="tools/htdocs/handlebars-v1.1.2.js"></script>
     <script type="text/javascript" src="tools/htdocs/jquery.json-2.4.js"></script>
index 6ec792d..19eff66 100644 (file)
@@ -31,7 +31,7 @@ describe("Check mkws_config object", function () {
 
 describe("Check pazpar2 config", function () {
     it("pazpar2path is a path or an full URL", function () {
-        expect(mkws_config.pazpar2_url).toMatch(/^(\/|http:\/\/)/)
+        expect(mkws_config.pazpar2_url).toMatch(/^(\/|https?:\/\/)/)
     });
 
     it("Check usesessions true/false", function () {
index 0cca4d7..b90b42d 100644 (file)
@@ -9,8 +9,10 @@ var debug = function (text) {
         mkws.debug_function(text)
     }
 
-
-var jasmine_config = {};
+    // Define empty mkws_config for simple applications that don't define it.
+if (jasmine_config == null || typeof jasmine_config != 'object') {
+    var jasmine_config = {};
+}
 
 /* check config for jasmine test
  *
@@ -18,7 +20,7 @@ var jasmine_config = {};
  * object: jasmine_config = {};
  *
  */
-beforeEach(function () {
+function init_jasmine_config() {
 
     var jasmine_config_default = {
         search_query: "freebsd",
@@ -38,8 +40,9 @@ beforeEach(function () {
         if (!jasmine_config.hasOwnProperty(key)) {
             jasmine_config[key] = jasmine_config_default[key];
         }
+        debug("jasmine config: " + key + " => " + jasmine_config[key]);
     }
-});
+}
 
 var get_hit_counter = function () {
         // not yet here
@@ -59,6 +62,17 @@ var get_hit_counter = function () {
         return hits;
     }
 
+describe("Init jasmine config", function () {
+    it("jasmine was successfully initialized", function () {
+        init_jasmine_config();
+
+        expect(jasmine_config.search_query).toMatch(/\w/);
+        expect(jasmine_config.second).toBeGreaterThan(100);
+        expect(jasmine_config.max_time).toBeGreaterThan(1);
+        expect(jasmine_config.expected_hits).toBeGreaterThan(1);
+    });
+});
+
 describe("Check pazpar2 search", function () {
     it("pazpar2 was successfully initialize", function () {
         expect(mkws_config.error).toBe(undefined);
@@ -279,7 +293,7 @@ describe("Show record", function () {
         debug("extracted URL from record: " + url);
 
         expect(url).not.toBe(null);
-        expect(url).toMatch(/^http:\/\/[a-z0-9]+\.[0-9a-z].*\//i);
+        expect(url).toMatch(/^https?:\/\/[a-z0-9]+\.[0-9a-z].*\//i);
     });
 });