X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fspec%2Fmkws-pazpar2.js;h=7e180c31cd8060983cef76bcc9e0b5facbcde367;hb=629f916bd15890ad6ac22d79fe45dbbd0286620c;hp=7c77122e1e1aad8c5976b94a8274fa9a7f461ee7;hpb=4565be9497ba70104b52f2a60c89d6b82f11e0fc;p=mkws-moved-to-github.git diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index 7c77122..7e180c3 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -318,24 +318,26 @@ 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; + }, "wait until we see a record", 1.5 * 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,14 +367,16 @@ describe("Show record", function () { return; } - var urls = $("div#mkwsRecords div.record:nth-child(" + record_number + ") div table tbody tr td a"); + var urls = $("div.mkwsRecords div.record:nth-child(" + record_number + ") div table tbody tr td a"); debug("number of extracted URL from record: " + urls.length); + // expect(urls.length).toBeGreaterThan(0); // LoC has records without links for (var i = 0; i < urls.length; i++) { var url = $(urls[i]); - debug("URL: " + url.attr('href')); + 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')).toBe(url.text()); + expect(url.text()).not.toBe(""); } }); });