The UI component for Meteos.
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.

test-shim.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Shim for Javascript unit tests; supplying expected global features.
  3. * This should be removed from the codebase once i18n services are provided.
  4. * Taken from default i18n file provided by Django.
  5. */
  6. var horizonPlugInModules = [];
  7. (function (globals) {
  8. var django = globals.django || (globals.django = {});
  9. django.pluralidx = function (count) { return (count == 1) ? 0 : 1; };
  10. /* gettext identity library */
  11. django.gettext = function (msgid) { return msgid; };
  12. django.ngettext = function (singular, plural, count) { return (count == 1) ? singular : plural; };
  13. django.gettext_noop = function (msgid) { return msgid; };
  14. django.pgettext = function (context, msgid) { return msgid; };
  15. django.npgettext = function (context, singular, plural, count) { return (count == 1) ? singular : plural; };
  16. django.interpolate = function (fmt, obj, named) {
  17. if (named) {
  18. return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});
  19. } else {
  20. return fmt.replace(/%s/g, function(match){return String(obj.shift())});
  21. }
  22. };
  23. /* formatting library */
  24. django.formats = {
  25. "DATETIME_FORMAT": "N j, Y, P",
  26. "DATETIME_INPUT_FORMATS": [
  27. "%Y-%m-%d %H:%M:%S",
  28. "%Y-%m-%d %H:%M:%S.%f",
  29. "%Y-%m-%d %H:%M",
  30. "%Y-%m-%d",
  31. "%m/%d/%Y %H:%M:%S",
  32. "%m/%d/%Y %H:%M:%S.%f",
  33. "%m/%d/%Y %H:%M",
  34. "%m/%d/%Y",
  35. "%m/%d/%y %H:%M:%S",
  36. "%m/%d/%y %H:%M:%S.%f",
  37. "%m/%d/%y %H:%M",
  38. "%m/%d/%y"
  39. ],
  40. "DATE_FORMAT": "N j, Y",
  41. "DATE_INPUT_FORMATS": [
  42. "%Y-%m-%d",
  43. "%m/%d/%Y",
  44. "%m/%d/%y"
  45. ],
  46. "DECIMAL_SEPARATOR": ".",
  47. "FIRST_DAY_OF_WEEK": "0",
  48. "MONTH_DAY_FORMAT": "F j",
  49. "NUMBER_GROUPING": "3",
  50. "SHORT_DATETIME_FORMAT": "m/d/Y P",
  51. "SHORT_DATE_FORMAT": "m/d/Y",
  52. "THOUSAND_SEPARATOR": ",",
  53. "TIME_FORMAT": "P",
  54. "TIME_INPUT_FORMATS": [
  55. "%H:%M:%S",
  56. "%H:%M:%S.%f",
  57. "%H:%M"
  58. ],
  59. "YEAR_MONTH_FORMAT": "F Y"
  60. };
  61. django.get_format = function (format_type) {
  62. var value = django.formats[format_type];
  63. if (typeof(value) == 'undefined') {
  64. return format_type;
  65. } else {
  66. return value;
  67. }
  68. };
  69. /* add to global namespace */
  70. globals.pluralidx = django.pluralidx;
  71. globals.gettext = django.gettext;
  72. globals.ngettext = django.ngettext;
  73. globals.gettext_noop = django.gettext_noop;
  74. globals.pgettext = django.pgettext;
  75. globals.npgettext = django.npgettext;
  76. globals.interpolate = django.interpolate;
  77. globals.get_format = django.get_format;
  78. globals.STATIC_URL = '/static/';
  79. globals.WEBROOT = '/';
  80. }(this));