Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

clock_es_spec.js 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. const helpers = require("../global-setup");
  2. describe("Clock set to spanish language module", function () {
  3. afterAll(function () {
  4. helpers.stopApplication();
  5. });
  6. const testMatch = function (element, regex) {
  7. const elem = document.querySelector(element);
  8. expect(elem).not.toBe(null);
  9. expect(elem.textContent).toMatch(regex);
  10. };
  11. describe("with default 24hr clock config", function () {
  12. beforeAll(function (done) {
  13. helpers.startApplication("tests/configs/modules/clock/es/clock_24hr.js");
  14. helpers.getDocument(done, 1000);
  15. });
  16. it("shows date with correct format", function () {
  17. const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
  18. testMatch(".clock .date", dateRegex);
  19. });
  20. it("shows time in 24hr format", function () {
  21. const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/;
  22. testMatch(".clock .time", timeRegex);
  23. });
  24. });
  25. describe("with default 12hr clock config", function () {
  26. beforeAll(function (done) {
  27. helpers.startApplication("tests/configs/modules/clock/es/clock_12hr.js");
  28. helpers.getDocument(done, 1000);
  29. });
  30. it("shows date with correct format", function () {
  31. const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
  32. testMatch(".clock .date", dateRegex);
  33. });
  34. it("shows time in 12hr format", function () {
  35. const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
  36. testMatch(".clock .time", timeRegex);
  37. });
  38. });
  39. describe("with showPeriodUpper config enabled", function () {
  40. beforeAll(function (done) {
  41. helpers.startApplication("tests/configs/modules/clock/es/clock_showPeriodUpper.js");
  42. helpers.getDocument(done, 1000);
  43. });
  44. it("shows 12hr time with upper case AM/PM", function () {
  45. const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
  46. testMatch(".clock .time", timeRegex);
  47. });
  48. });
  49. describe("with showWeek config enabled", function () {
  50. beforeAll(function (done) {
  51. helpers.startApplication("tests/configs/modules/clock/es/clock_showWeek.js");
  52. helpers.getDocument(done, 1000);
  53. });
  54. it("shows week with correct format", function () {
  55. const weekRegex = /^Semana [0-9]{1,2}$/;
  56. testMatch(".clock .week", weekRegex);
  57. });
  58. });
  59. });