X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fspec%2Fmkws-pazpar2.js;h=211b61c9e2c336a878d33b3d8ecd8b493c53c038;hb=ba4eb503acca0f5208aca788b23437b0101cba86;hp=9a05f530647580a5b9797f87d9343796e138bfe7;hpb=ce4945b7cc8721a6855e98a05fb1ea9a89a19f12;p=mkws-moved-to-github.git diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index 9a05f53..211b61c 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -254,7 +254,7 @@ describe("Check Termlist", function () { waitsFor(function () { return $("div.mkwsFacet[data-mkws-facet='author'] div.mkwsTerm").length >= 2 ? true : false; - }, "At least one author link displayed", 4 * jasmine_config.second); + }, "At least two author link displayed", 4 * jasmine_config.second); runs(function () { expect($("div.mkwsFacet[data-mkws-facet='author'] div.mkwsTerm").length).toBeGreaterThan(1); @@ -676,7 +676,7 @@ describe("Check SortBy options", function () { var list = []; var terms = $("div.mkwsRecords > div.mkwsSummary > a"); for (var i = 0; i < terms.length; i++) { - var term = $(terms[i]).text(); + var term = $(terms[i]).text().trim(); list.push(term); // debug(prefix + "title: " + term); } @@ -716,7 +716,7 @@ describe("Check SortBy options", function () { var title_list_new = title_list("yyy "); var diff_flag = 0; for (var i = 0; i < title_list_old.length; i++) { - debug(title_list_old[i] + " :: " + title_list_new[i]); + debug((i+1) + ". " + title_list_old[i] + " :: " + title_list_new[i]); if (title_list_old[i] != title_list_new[i]) { diff_flag++; @@ -728,15 +728,22 @@ describe("Check SortBy options", function () { }); }); -xdescribe("Check async widget discovery", function () { +describe("Check async widget discovery", function () { var $ = mkws.$; it("initialises a new widget", function() { - $("div.mkwsSearch").after('
'); - mkws.init("Another search box"); - // mkws.init("Another search box", "#asyncSearch"); + $("div.mkwsSearch").after('
'); + mkws.init("Another search box", "#asyncSearch"); waitsFor(function () { return $("#asyncSearch input").length >= 1 ? true : false; }, "Call init() to build an .mkwsSearch", 750); + runs(function () { + var numInput = $("div.mkwsSearch input").length; + debug("Input elements present: " + numInput); + expect(numInput).toBe(4); + var numRec = $("div.mkwsRecords > div.mkwsSummary > a").length; + debug("Records should still be present. There are: " + numRec); + expect(numRec).toBeGreaterThan(0); + }); }); });