config option disable_facet_authors_search, MKWS-114
[mkws-moved-to-github.git] / test / spec / mkws-pazpar2.js
index 239cc20..42d3480 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013 IndexData ApS. http://indexdata.com
+/* Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com
  *
  * perform papzpar2 / pz2.js search & retrieve request in the browser
  *
@@ -76,7 +76,7 @@ describe("Init jasmine config", function () {
 });
 
 describe("Check pazpar2 search", function () {
-    it("pazpar2 was successfully initialize", function () {
+    it("pazpar2 was successfully initialized", function () {
         expect(mkws_config.error).toBe(undefined);
     });
 
@@ -208,6 +208,11 @@ describe("Check Termlist", function () {
     });
 
     it("limit search to first author", function () {
+        if (mkws_config.disable_facet_authors_search) {
+            debug("Facets: ignore limit search for authors");
+            return;
+        }
+
         var hits_all_targets = get_hit_counter();
         var author_number = 2; // 2=first author
         // do not click on author with numbers, e.g.: "Bower, James M. Beeman, David, 1938-"
@@ -258,7 +263,7 @@ describe("Check Termlist", function () {
         expect(click.length).toBe(1);
 
         waitsFor(function () {
-            if ($("div#mkwsNavi").length && $("div#mkwsNavi").text().match(/Source: /)) {
+            if ($("div#mkwsNavi").length && $("div#mkwsNavi").text().match(/(Source|datenquelle|kilder): /i)) {
                 return true;
             } else {
                 return false;
@@ -282,7 +287,7 @@ describe("Check Termlist", function () {
 describe("Show record", function () {
     var record_number = 1; // the Nth record in hit list
     it("show record author", function () {
-        var click = $("div#mkwsRecords div.record:nth-child(" + record_number + ") a").trigger("click");
+        var click = $("div.mkwsRecords div.record:nth-child(" + record_number + ") a").trigger("click");
         debug("show record click is success: " + click.length);
         expect(click.length).toBe(1);
 
@@ -325,7 +330,7 @@ describe("Check switch menu Records/Targets", function () {
     });
 
     it("switch to target view", function () {
-        var click = $("a.mkwsSwitch_targets").trigger("click");
+        var click = $("div.mkwsSwitch").children('a').eq(1).trigger("click");
         debug("target view click is success: " + click.length);
         expect(click.length).toBe(1);
 
@@ -346,7 +351,7 @@ describe("Check switch menu Records/Targets", function () {
     });
 
     it("switch back to record view", function () {
-        var click = $("a.mkwsSwitch_records").trigger("click");
+        var click = $("div.mkwsSwitch").children('a').eq(0).trigger("click");
         debug("record view click is success: " + click.length);
         expect(click.length).toBe(1);