stubs.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**
  2. * Test stubs to mirror available global variables.
  3. * Those variables usually come from the back-end via templates.
  4. * See /wagtailadmin/templates/wagtailadmin/admin_base.html.
  5. */
  6. global.wagtailConfig = {
  7. ADMIN_API: {
  8. DOCUMENTS: '/admin/api/v2beta/documents/',
  9. IMAGES: '/admin/api/v2beta/images/',
  10. PAGES: '/admin/api/v2beta/pages/',
  11. EXTRA_CHILDREN_PARAMETERS: '',
  12. },
  13. ADMIN_URLS: {
  14. PAGES: '/admin/pages/',
  15. },
  16. DATE_FORMATTING: {
  17. DATE_FORMAT: 'MMM. D, YYYY',
  18. SHORT_DATE_FORMAT: 'DD/MM/YYYY',
  19. },
  20. STRINGS: {
  21. EDIT: 'Edit',
  22. DELETE: 'Delete',
  23. PAGE: 'Page',
  24. PAGES: 'Pages',
  25. LOADING: 'Loading…',
  26. NO_RESULTS: 'No results',
  27. SERVER_ERROR: 'Server Error',
  28. SEE_CHILDREN: 'See children',
  29. SEE_ALL: 'See all',
  30. CLOSE_EXPLORER: 'Close explorer',
  31. ALT_TEXT: 'Alt text',
  32. WRITE_HERE: 'Write here…',
  33. HORIZONTAL_LINE: 'Horizontal line',
  34. LINE_BREAK: 'Line break',
  35. UNDO: 'Undo',
  36. REDO: 'Redo',
  37. },
  38. };
  39. global.wagtailVersion = '1.6a1';
  40. global.chooserUrls = {
  41. documentChooser: '/admin/documents/chooser/',
  42. emailLinkChooser: '/admin/choose-email-link/',
  43. embedsChooser: '/admin/embeds/chooser/',
  44. externalLinkChooser: '/admin/choose-external-link/',
  45. imageChooser: '/admin/images/chooser/',
  46. pageChooser: '/admin/choose-page/',
  47. snippetChooser: '/admin/snippets/choose/',
  48. };
  49. const jQueryObj = {
  50. on: jest.fn(),
  51. off: jest.fn(),
  52. };
  53. global.jQuery = () => jQueryObj;