From c28de7264b49fa0c511392dc22a5eeaff0e5bcf3 Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Wed, 28 Jan 2015 13:04:25 +0000 Subject: [PATCH] check translations, MKWS-365 --- src/templates/ranking.handlebars | 6 +++--- test/spec/mkws-pazpar2.js | 32 +++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/templates/ranking.handlebars b/src/templates/ranking.handlebars index 890e29a..6e02ecc 100644 --- a/src/templates/ranking.handlebars +++ b/src/templates/ranking.handlebars @@ -14,7 +14,7 @@ perPage }}
{{~#if showSort~}} - {{{mkws-translate "Sort by"}}} + {{{mkws-translate "Sort by"}}} {{~/if~}} {{~#if showPerPage}} - {{{mkws-translate "and show"}}} + {{{mkws-translate "and show"}}} - {{{mkws-translate "per page"}}} + {{{mkws-translate "per page"}}} {{~/if~}}
diff --git a/test/spec/mkws-pazpar2.js b/test/spec/mkws-pazpar2.js index ab1f380..e5140c2 100644 --- a/test/spec/mkws-pazpar2.js +++ b/test/spec/mkws-pazpar2.js @@ -738,7 +738,37 @@ describe("Check SortBy options", function () { }); }); -describe("Check async widget discovery", function () { +describe("Check translations", function () { + var $ = mkws.$; + + it("check language", function () { + var lang = mkws.config.lang; + debug("lang: " + lang); + expect(lang).toMatch(/^(de|da|)$/); + }); + + it("ranking form", function () { + var list = $(".mkws-ranking > form > span"); + var lang = mkws.config.lang; + + expect(list.length).toBe(3); + + expect(mkws.M("Sort by")).toBe($(list[0]).text()); + expect(mkws.M("and show")).toBe($(list[1]).text()); + expect(mkws.M("per page")).toBe($(list[2]).text()); + + // double check + if (lang == "de") { + expect(mkws.M("Sort by")).toBe("Sortieren nach"); + expect($(list[0]).text()).toBe("Sortieren nach"); + } else if (lang == "da") { + expect(mkws.M("Sort by")).toBe("Sorter efter"); + expect($(list[0]).text()).toBe("Sorter efter"); + } + }); +}); + +xdescribe("Check async widget discovery", function () { var $ = mkws.$; it("initialises a new widget", function () { $("div.mkws-search").after('
'); -- 1.7.10.4