From eaa05bbce693bf8084190ba8c0ba05d94eef6366 Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Mon, 7 Jul 2014 08:55:17 +0000 Subject: [PATCH] Jasmine test should check that sorting works, MKWS-140 --- test/spec/mkws-pazpar2.js | 87 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index a9e337b..fb391c3 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -241,6 +241,8 @@ describe("Check Termlist", function () { }); }); + + describe("Check Author Facets", function () { it("limit search to first author", function () { if (mkws.config.disable_facet_authors_search) { @@ -522,6 +524,91 @@ describe("Check status client counter", function () { }); }); +describe("Check removable links", function () { + var $ = mkws.$; + + it("remove links for source and author", function () { + var click = mkws.$("a.mkwsRemovable").trigger("click"); + debug("Removed facets links: " + click.length); + expect(click.length).toBe(2); + }); +}); + +describe("Check per page options", function () { + var $ = mkws.$; + + it("show per page", function () { + var waitcount = 0; + + runs(function () { + var select = $("select.mkwsPerpage option[selected='selected']"); + debug("per page default is: " + select.text()); + + select = $("select.mkwsPerpage option[value='20']").attr('selected', 'selected'); + debug("per page is set to: " + select.text()); + + $("div.mkwsRecords").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () { + waitcount++; + debug("DOM wait for stat: " + waitcount); + }); + }); + + waitsFor(function () { + waitcount >= 1 ? true : false; + }); + + + runs(function () { + $("div.mkwsRecords").unbind("DOMNodeInserted DOMNodeRemoved propertychange"); + }); + }); +}); + + +describe("Check SortBy options", function () { + var $ = mkws.$; + + it("sort by title", function () { + var waitcount = 0; + + runs(function () { + var terms = $("div.mkwsRecords > div > a"); + for (var i = 0; i < terms.length; i++) { + var term = $(terms[i]).text(); + debug("xxx: " + term); + } + }); + + runs(function () { + var select = $("select.mkwsSort option[selected='selected']"); + debug("Sort by default: " + select.text()); + + select = $("select.mkwsSort option[value='title:1']").attr('selected', 'selected'); + debug("Sort by is set to: " + select.text()); + + $("div.mkwsRecords").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () { + waitcount++; + debug("DOM wait for stat: " + waitcount); + }); + }); + + waitsFor(function () { + waitcount >= 1 ? true : false; + }); + + + runs(function () { + var terms = $("div.mkwsRecords > div > a"); + for (var i = 0; i < terms.length; i++) { + var term = $(terms[i]).text(); + debug("yyy: " + term); + } + + $("div.mkwsRecords").unbind("DOMNodeInserted DOMNodeRemoved propertychange"); + }); + }); +}); + /* done */ describe("All tests are done", function () { it(">>> hooray <<<", function () { -- 1.7.10.4