From 317e6b59e8f277b879e597c2f50afce539e106cc Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Wed, 28 Jan 2015 15:36:29 +0000 Subject: [PATCH] run translation check earlier, before Check removable facets links --- test/spec/mkws-pazpar2.js | 245 +++++++++++++++++++++++---------------------- 1 file changed, 123 insertions(+), 122 deletions(-) diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index e9aa610..aba33c0 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -526,6 +526,129 @@ describe("Check switch menu Records/Targets", function () { }); }); +describe("Check translations", function () { + var $ = mkws.$; + + // handle html entities, "Zurück" => "Zurück" + var M = function (string) { + var text = $("").html(mkws.M(string)).text() + debug("translate check for: " + text); + return text; + }; + var lang = function () { + return mkws.config.lang + }; + + function check_translation(list, text) { + expect(list.length).toBe(text.length); + + for (var i = 0; i < text.length; i++) { + expect($(list[i]).text()).toBe(M(text[i])); + } + } + + it("check language", function () { + var lang = mkws.config.lang; + debug("lang: " + lang); + expect(lang).toMatch(/^(de|da|)$/); + }); + +/* + locale_lang: { + "de": { + "Authors": "Autoren", + "Subjects": "Schlagwörter", + "Sources": "Daten und Quellen", + "source": "datenquelle", + "Facets": "Termlisten", + "Next": "Weiter", + "Prev": "Zurück", + "Search": "Suche", + "Sort by": "Sortieren nach", + "and show": "und zeige", + "per page": "pro Seite", + "Displaying": "Zeige", + "to": "von", + "of": "aus", + "found": "gefunden", + "Title": "Titel", + "Author": "Autor", + "author": "autor", + "Date": "Datum", + "Subject": "Schlagwort", + "subject": "schlagwort", + "Location": "Ort", + "Records": "Datensätze", + "Targets": "Datenbanken", + + "dummy": "dummy" + }, +*/ + + it("search button", function () { + var list = $(".mkws-pager-desc > span"); + expect($("form > input[type=submit]").attr("value")).toBe(M("Search")); + }); + + it("switch", function () { + var list = $(".mkws-switch > a") + var text = ["Records", "Targets"]; + + check_translation(list, text); + }); + + + it("ranking form", function () { + var list = $(".mkws-ranking > form > span"); + var text = ["Sort by", "and show", "per page"]; + + check_translation(list, text); + + // double check + if (lang == "de") { + expect("Sortieren nach").toBe(M("Sort by")); + expect("Sortieren nach").toBe($(list[0]).text()); + } else if (lang == "da") { + expect("Sorter efter").toBe(M("Sort by")); + expect("Sorter efter").toBe($(list[0]).text()); + } + }); + + xit("facets sidebar", function () { + var list = $(".mkws-facet-title"); + var text = ["Sources", "Subjects", "Authors"]; + + check_translation(list, text); + }); + + it("facets navigation/filter", function () { + var list = $(".mkws-navi > span"); + var text = ["source", "author"]; + + check_translation(list, text); + }); + + it("navigation", function () { + var list = $(".mkws-pager-desc > span"); + var text = ["Displaying", "to", "of", "found"]; + + check_translation(list, text); + + expect($(".mkws-next").text()).toBe(M("Next")); + expect($(".mkws-prev").text()).toBe(M("Prev")); + }); + + it("record details", function () { + var text = ["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); + }); +}); + describe("Check status client counter", function () { var $ = mkws.$; @@ -738,128 +861,6 @@ describe("Check SortBy options", function () { }); }); -describe("Check translations", function () { - var $ = mkws.$; - - // handle html entities, "Zurück" => "Zurück" - var M = function (string) { - var text = $("").html(mkws.M(string)).text() - debug("translate check for: " + text); - return text; - }; - var lang = function () { - return mkws.config.lang - }; - - function check_translation(list, text) { - expect(list.length).toBe(text.length); - - for (var i = 0; i < text.length; i++) { - expect($(list[i]).text()).toBe(M(text[i])); - } - } - - it("check language", function () { - var lang = mkws.config.lang; - debug("lang: " + lang); - expect(lang).toMatch(/^(de|da|)$/); - }); - -/* - locale_lang: { - "de": { - "Authors": "Autoren", - "Subjects": "Schlagwörter", - "Sources": "Daten und Quellen", - "source": "datenquelle", - "Facets": "Termlisten", - "Next": "Weiter", - "Prev": "Zurück", - "Search": "Suche", - "Sort by": "Sortieren nach", - "and show": "und zeige", - "per page": "pro Seite", - "Displaying": "Zeige", - "to": "von", - "of": "aus", - "found": "gefunden", - "Title": "Titel", - "Author": "Autor", - "author": "autor", - "Date": "Datum", - "Subject": "Schlagwort", - "subject": "schlagwort", - "Location": "Ort", - "Records": "Datensätze", - "Targets": "Datenbanken", - - "dummy": "dummy" - }, -*/ - - it("search button", function () { - var list = $(".mkws-pager-desc > span"); - expect($("form > input[type=submit]").attr("value")).toBe(M("Search")); - }); - - it("switch", function () { - var list = $(".mkws-switch > a") - var text = ["Records", "Targets"]; - - check_translation(list, text); - }); - - - it("ranking form", function () { - var list = $(".mkws-ranking > form > span"); - var text = ["Sort by", "and show", "per page"]; - - check_translation(list, text); - - // double check - if (lang == "de") { - expect("Sortieren nach").toBe(M("Sort by")); - expect("Sortieren nach").toBe($(list[0]).text()); - } else if (lang == "da") { - expect("Sorter efter").toBe(M("Sort by")); - expect("Sorter efter").toBe($(list[0]).text()); - } - }); - - xit("facets sidebar", function () { - var list = $(".mkws-facet-title"); - var text = ["Sources", "Subjects", "Authors"]; - - check_translation(list, text); - }); - - it("facets navigation/filter", function () { - var list = $(".mkws-navi > span"); - var text = ["source", "author"]; - - check_translation(list, text); - }); - - it("navigation", function () { - var list = $(".mkws-pager-desc > span"); - var text = ["Displaying", "to", "of", "found"]; - - check_translation(list, text); - - expect($(".mkws-next").text()).toBe(M("Next")); - expect($(".mkws-prev").text()).toBe(M("Prev")); - }); - - it("record details", function () { - var text = ["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); - }); -}); xdescribe("Check async widget discovery", function () { var $ = mkws.$; -- 1.7.10.4