From 3e2d556873ff8f507caea7a6918ad630b634daf1 Mon Sep 17 00:00:00 2001 From: Heikki Levanto Date: Fri, 7 Mar 2014 13:40:03 +0100 Subject: [PATCH] Do not test the return value of .trigger("click") The tirgger() is supposed to return this, but seems not to do so always. The subsequent tests confirm that the click event has happened anyway. If the click event does not happen for some reason, the next tests will fail, so I believe the testing is as good. --- test/spec/mkws-pazpar2.js | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index 733f7a4..6643791 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -126,8 +126,7 @@ describe("Check pazpar2 search", function () { runs(function () { debug("Click on submit button"); - var click = $("input.mkwsButton").trigger("click"); - expect(click.length).toBe(1); + $("input.mkwsButton").trigger("click"); }) }); }); @@ -158,10 +157,7 @@ describe("Check pazpar2 navigation", function () { function my_click(id, time) { setTimeout(function () { debug("trigger click on id: " + id); - var click = $(id).trigger("click"); - - debug("next/prev: " + id + " click is success: " + click.length); - expect(click.length).toBe(1); + $(id).trigger("click"); }, time * jasmine_config.second); } @@ -261,9 +257,7 @@ describe("Check Termlist", function () { } } - var click = $("div.mkwsFacetAuthors div.term:nth-child(" + author_number + ") a").trigger("click"); - debug("limit author click is success: " + click.length); - expect(click.length).toBe(1); + $("div.mkwsFacetAuthors div.term:nth-child(" + author_number + ") a").trigger("click"); waitsFor(function () { return get_hit_counter() < hits_all_targets ? true : false; @@ -291,10 +285,8 @@ describe("Check Termlist", function () { } } - var click = $("div.mkwsFacetSources div.term:nth-child(" + source_number + ") a").trigger("click"); - debug("limit source click " + (source_number - 1) + " is success: " + click.length); - expect(click.length).toBe(1); - + $("div.mkwsFacetSources div.term:nth-child(" + source_number + ") a").trigger("click"); + waitsFor(function () { if ($("div.mkwsNavi").length && $("div.mkwsNavi").text().match(/(Source|datenquelle|kilder): /i)) { return true; @@ -320,10 +312,12 @@ describe("Check Termlist", function () { describe("Show record", function () { var record_number = 1; // the Nth record in hit list it("show record author", function () { - var click = $("div.mkwsRecords div.record:nth-child(" + record_number + ") a").trigger("click"); + $("div.mkwsRecords div.record:nth-child(" + record_number + ") a").trigger("click"); +/* debug("### click=" + typeof(click) + " " + click ); + debug("### len=" + click.length ); 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"); @@ -363,9 +357,7 @@ describe("Check switch menu Records/Targets", function () { }); it("switch to target view", function () { - var click = $("div.mkwsSwitch").children('a').eq(1).trigger("click"); - debug("target view click is success: " + click.length); - expect(click.length).toBe(1); + $("div.mkwsSwitch").children('a').eq(1).trigger("click"); // now the target table must be visible expect($("div.mkwsBytarget").is(":visible")).toBe(true); @@ -384,9 +376,7 @@ describe("Check switch menu Records/Targets", function () { }); it("switch back to record view", function () { - var click = $("div.mkwsSwitch").children('a').eq(0).trigger("click"); - debug("record view click is success: " + click.length); - expect(click.length).toBe(1); + $("div.mkwsSwitch").children('a').eq(0).trigger("click"); // now the target table must be visible expect($("div.mkwsBytarget").is(":visible")).toBe(false); -- 1.7.10.4