X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fspec%2Fmkws-pazpar2.js;h=9503683081ad0359a8d1f95fcf0acdaddc24cde2;hb=8d2e36a0a3df10e829a647d7488c609837049876;hp=cb5ba41f3089e9d13fd9db8b358f5511c4020fe3;hpb=30d4c34eebe574801b03fb88293c74728d9aaf82;p=mkws-moved-to-github.git diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index cb5ba41..9503683 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -318,23 +318,25 @@ describe("Check Termlist", function () { }); }); + describe("Check record list", function () { it("got a record", function () { - // make sure we have a link. var linkaddr = "div.mkwsRecords div.record:nth-child(1) a"; var waitcount = 0; - waitsFor(function () { + // wait for new records + $("div.mkwsRecords").bind("DOMSubtreeModified", function () { waitcount++; - debug("waiting for the link " + waitcount + " " + $(linkaddr) + " =" + $(linkaddr).length + " " + $(linkaddr).text()); - return ($(linkaddr).length > 0); - }, "wait until we see a link", 1 * jasmine_config.second); + debug("DOM div.mkwsRecords changed"); + }); + + waitsFor(function () { + return waitcount > 0 && $(linkaddr).length > 0; + }, "wait until we see a new record", 2.2 * jasmine_config.second); runs(function () { - var link = $(linkaddr); - debug("== waited (" + waitcount + ") for the link..." + $(linkaddr) + " =" + $(linkaddr).length + " " + $(linkaddr).text()); - expect(link.length).toBe(1); - // link.trigger("click"); + expect(waitcount).toBeGreaterThan(0); + $("div.mkwsRecords").unbind("DOMSubtreeModified"); }); }); });