X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=test%2Fspec%2Fmkws-pazpar2.js;h=76f4834209897139a029bd3fbe8ae2b96b2dc100;hb=48e96731e9c48f770a3ee027c020a0113f703592;hp=fe1e746e5b001ae06212cc3c2ab15391a5668720;hpb=738d2b9639224b05db381edd0e2f0c577310fb64;p=mkws-moved-to-github.git diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index fe1e746..76f4834 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -311,23 +311,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 propertychange", 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"); }); }); }); @@ -365,7 +367,7 @@ describe("Show record", function () { debug("URL: " + url.attr('href') + " text: " + url.text()); expect(url.attr('href')).not.toBe(null); - expect(url.attr('href')).toMatch(/^https?:\/\/[a-z0-9]+\.[0-9a-z].*\//i); + expect(url.attr('href')).toMatch(/^https?:\/\/[a-z0-9\-]+\.[0-9a-z].*\//i); expect(url.text()).not.toBe(""); } });