X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fspec%2Fmkws-pazpar2.js;h=fe0e3458b91ed49dba06121842b74e21d9e38bdc;hb=a1857b32353c865b611eec9ee98ac532ff83dd3d;hp=ed76bf068e289e6d37192176c9c3597369d3e5a9;hpb=6615ad84b68b298fd2683170e43482031f1baab0;p=mkws-moved-to-github.git diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index ed76bf0..fe0e345 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com +/* Copyright (c) 2013-2014 Index Data ApS. http://indexdata.com * * perform papzpar2 / pz2.js search & retrieve request in the browser * @@ -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); } @@ -707,7 +707,7 @@ describe("Check SortBy options", 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); }); @@ -728,6 +728,24 @@ describe("Check SortBy options", function () { }); }); +describe("Check async widget discovery", function () { + var $ = mkws.$; + it("initialises a new widget", function() { + $("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); + }); + }); +}); /* done */ describe("All tests are done", function () {