X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=test%2Fspec%2Fmkws-pazpar2.js;h=e01f5fef8d5110a86adb720f421b4b18c8de158a;hb=ab01c349aa177a9dd8a91967a5ea1eca23526fc8;hp=e24a1bdb6258a7de699974878a980f194b8a923c;hpb=cd98664aa255423195fd3a63d7b738171a25ae28;p=mkws-moved-to-github.git
diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js
index e24a1bd..e01f5fe 100644
--- a/test/spec/mkws-pazpar2.js
+++ b/test/spec/mkws-pazpar2.js
@@ -526,6 +526,136 @@ 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",
+ "relevance": "Relevanz",
+ "title": "Titel",
+ "newest": "Neueste",
+ "oldest": "Älteste",
+
+ "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());
+ }
+
+
+ expect($("select.mkws-sort > option[selected=selected]").text()).toBe(M("relevance"));
+ });
+
+ 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.$;
@@ -667,7 +797,7 @@ describe("Check per page options", function () {
describe("Check SortBy options", function () {
var $ = mkws.$;
- it("show per page", function () {
+ it("sort by title", function () {
if (!jasmine_config.check_sortby) {
debug("ignore check for sort by");
return;
@@ -738,113 +868,6 @@ describe("Check SortBy options", function () {
});
});
-describe("Check translations", function () {
- var $ = mkws.$;
- // handle html entities, "Zurück" => "Zurück"
- var M = function (string) {
- return $("").html(mkws.M(string)).text()
- };
- var lang = function () {
- return mkws.config.lang
- };
-
- 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-switch > a")
-
- expect(list.length).toBe(2);
- expect($(list[0]).text()).toBe(M("Records"));
- expect($(list[1]).text()).toBe(M("Targets"));
- });
-
- it("switch", function () {
- var list = $(".mkws-pager-desc > span");
- expect($("form > input[type=submit]").attr("value")).toBe(M("Search"));
- });
-
-
- it("ranking form", function () {
- var list = $(".mkws-ranking > form > span");
-
- expect(list.length).toBe(3);
-
- expect($(list[0]).text()).toBe(M("Sort by"));
- expect($(list[1]).text()).toBe(M("and show"));
- expect($(list[2]).text()).toBe(M("per page"));
-
- // 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", function () {
- var list = $(".mkws-facet-title");
-
- expect(list.length).toBe(3);
-
- expect($(list[0]).text()).toBe(M("Sources"));
- expect($(list[1]).text()).toBe(M("Subjects"));
- expect($(list[2]).text()).toBe(M("Authors"));
- });
-
- it("navigation", function () {
- var list = $(".mkws-pager-desc > span");
-
- expect(list.length).toBe(4);
-
- expect($(list[0]).text()).toBe(M("Displaying"));
- expect($(list[1]).text()).toBe(M("to"));
- expect($(list[2]).text()).toBe(M("of"));
- expect($(list[3]).text()).toBe(M("found"));
-
- expect($(".mkws-next").text()).toBe(M("Next"));
- expect($(".mkws-prev").text()).toBe(M("Prev"));
- });
-
-
-});
xdescribe("Check async widget discovery", function () {
var $ = mkws.$;