X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fspec%2Fmkws-pazpar2.js;h=eb25086c5ad6f6d9a5e1ef0c71a77e55d357ad38;hb=99f12f4cbd8c7a89b5b976fe2c1a7d40e4c5441e;hp=23ef7feecbc94c2178a6f1fff064848e6f15b623;hpb=431016e6786908aef265c74f28c8b3ddc230e2f6;p=mkws-moved-to-github.git diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index 23ef7fe..eb25086 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -56,28 +56,30 @@ function init_jasmine_config() { } mkws.jasmine_done = false; -} - -var get_hit_counter = function () { - // not yet here - if ($(".mkwsPager").length == 0) return -1; - - var found = $(".mkwsPager").text(); - var re = /\([A-Za-z]+:\s+([0-9]+)\)/; - re.exec(found); - var hits = -1; +}; - if (RegExp.$1) { - hits = parseInt(RegExp.$1); - if (hits <= 0) { - debug("Oooops in get_hit_counter: " + RegExp.$1 + " '" + found + "'"); - } +function get_hit_counter() { + var $ = mkws.$; + // not yet here + if ($(".mkwsPager").length == 0) return -1; + + var found = $(".mkwsPager").text(); + var re = /\([A-Za-z]+:\s+([0-9]+)\)/; + re.exec(found); + var hits = -1; + + if (RegExp.$1) { + hits = parseInt(RegExp.$1); + if (hits <= 0) { + debug("Oooops in get_hit_counter: " + RegExp.$1 + " '" + found + "'"); } - - //debug("Hits: " + hits); - return hits; } + //debug("Hits: " + hits); + return hits; +}; + +/******************************************************************************/ describe("Init jasmine config", function () { it("jasmine was successfully initialized", function () { init_jasmine_config(); @@ -91,6 +93,8 @@ describe("Init jasmine config", function () { //disabled xdescribe("Check MOTD before search", function () { + var $ = mkws.$; + // Check that the MOTD has been moved into its container, and // is visible before the search. // the mkwsMOTD div was originally inside a testMOTD div, which should @@ -696,14 +700,14 @@ describe("Check SortBy options", function () { waitsFor(function () { //debug("wait for2: " + waitcount); - return waitcount >= (per_page_number + 10)? true : false; + return waitcount >= (per_page_number + 10) ? true : false; }, "DOM change mkwsRecords, by sort page", 3 * jasmine_config.second); runs(function () { $("div.mkwsRecords").unbind("DOMNodeInserted DOMNodeRemoved propertychange"); debug("unbind by sort"); - var records = $("div.mkwsRecords > div.mkwsSummary a"); + var records = $("div.mkwsRecords > div.mkwsSummary > a"); debug("Sort by got now " + records.length + " records"); expect(records.length).toBe(per_page_number); });