From a624dd6b184108361c07603013a5137e74a95a06 Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Mon, 27 Jul 2015 13:28:21 +0000 Subject: [PATCH] enable translation check again, part of MKWS-400 The check will now accept one missing field (e.g. Author) --- test/spec/mkws-pazpar2.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index 64e9815..12cbfcf 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -559,7 +559,7 @@ describe("Check switch menu Records/Targets", function () { }); // temporary disabled due records without an author, MKWS-400 -xdescribe("Check translations", function () { +describe("Check translations", function () { var $ = mkws.$; // handle html entities, "Zurück" => "Zurück" @@ -568,6 +568,7 @@ xdescribe("Check translations", function () { debug("translate check for: " + text); return text; }; + var lang = function () { return mkws.config.lang }; @@ -580,6 +581,24 @@ xdescribe("Check translations", function () { } } + function check_translation_list(list, keywords) { + var errors = []; + for (var i = 0; i < keywords.length; i++) { + var text = $(list[i]); + var keyword = keywords[i]; + + if (text.text().match("^" + M(keyword) + "")) { + debug("found: " + text.text() + " :: " + keyword); + } else { + debug("NOT found: " + text.text() + " :: " + keyword); + errors.push(keyword) + } + } + + // we except one missing field, or one error + expect(errors.length).not.toBeGreaterThan(1); + } + it("check language", function () { var lang = mkws.config.lang; debug("lang: " + lang); @@ -680,13 +699,12 @@ xdescribe("Check translations", function () { }); it("record details", function () { - var text = ["Title", "Date", "Author"]; // , "Subject", "Locations"]; + var keywords = ["Title", "Date", "Author"]; // , "Subject", "Locations"]; var list = $("div.mkws-details table > tbody > tr > th"); // compare only the first 3 elements - list = list.splice(0, text.length) - - check_translation(list, text); + // list = list.splice(0, text.length) + check_translation_list(list, keywords); }); /* not tested -- 1.7.10.4