+ var click = $("div.mkwsRecords div.record:nth-child(" + record_number + ") a").trigger("click");
+ debug("show record click is success: " + click.length);
+ expect(click.length).toBe(1);
+
+ // wait until the record pops up
+ waitsFor(function () {
+ var show = $("div.mkwsRecords div.record:nth-child(" + record_number + ") div");
+ return show != null && show.length ? true : false;
+ }, "wait some miliseconds to show up a record", 2 * jasmine_config.second);
+
+ runs(function () {
+ debug("show record pop up");
+ expect($("div.mkwsRecords div.record:nth-child(" + record_number + ") div")).not.toBe(null);
+ });
+ });
+
+ it("extract URL", function () {
+ if (jasmine_config.show_record_url == false) {
+ debug("ignore test for URL in record")
+ return;
+ }
+
+ 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') + " 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.text()).not.toBe("");
+ }
+ });
+});
+
+describe("Check switch menu Records/Targets", function () {
+ it("check mkwsSwitch", function () {
+ expect($("div.mkwsSwitch").length).toBe(1);
+
+ // expect 2 clickable links
+ expect($("div.mkwsSwitch a").length).toBe(2);
+ });
+
+ it("switch to target view", function () {
+ $("div.mkwsSwitch").children('a').eq(1).trigger("click");
+
+ // now the target table must be visible
+ expect($("div.mkwsBytarget").is(":visible")).toBe(true);
+ expect($("div.mkwsRecords").is(":visible")).toBe(false);
+
+ // wait a half second, to show the target view
+ var time = (new Date).getTime();
+ waitsFor(function () {
+ return (new Date).getTime() - time > 700 ? true : false;
+ }, "wait some miliseconds", 1 * jasmine_config.second);
+
+ // look for table header
+ runs(function () {
+ expect($("div.mkwsBytarget").html()).toMatch(/Target ID/);
+ });
+ });
+
+ it("switch back to record view", function () {
+ $("div.mkwsSwitch").children('a').eq(0).trigger("click");
+
+ // now the target table must be visible
+ expect($("div.mkwsBytarget").is(":visible")).toBe(false);
+ expect($("div.mkwsRecords").is(":visible")).toBe(true);