stubs.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. import 'element-closest';
  7. global.wagtailConfig = {
  8. ADMIN_API: {
  9. DOCUMENTS: '/admin/api/v2beta/documents/',
  10. IMAGES: '/admin/api/v2beta/images/',
  11. PAGES: '/admin/api/v2beta/pages/',
  12. EXTRA_CHILDREN_PARAMETERS: '',
  13. },
  14. ADMIN_URLS: {
  15. PAGES: '/admin/pages/',
  16. },
  17. DATE_FORMATTING: {
  18. DATE_FORMAT: 'MMM. D, YYYY',
  19. SHORT_DATE_FORMAT: 'DD/MM/YYYY',
  20. },
  21. STRINGS: {
  22. EDIT: 'Edit',
  23. DELETE: 'Delete',
  24. PAGE: 'Page',
  25. PAGES: 'Pages',
  26. LOADING: 'Loading…',
  27. NO_RESULTS: 'No results',
  28. SERVER_ERROR: 'Server Error',
  29. SEE_CHILDREN: 'See children',
  30. SEE_ALL: 'See all',
  31. CLOSE_EXPLORER: 'Close explorer',
  32. ALT_TEXT: 'Alt text',
  33. WRITE_HERE: 'Write here…',
  34. HORIZONTAL_LINE: 'Horizontal line',
  35. LINE_BREAK: 'Line break',
  36. UNDO: 'Undo',
  37. REDO: 'Redo',
  38. RELOAD_PAGE: 'Reload the page',
  39. RELOAD_EDITOR: 'Reload the editor',
  40. SHOW_LATEST_CONTENT: 'Show latest content',
  41. EDITOR_CRASH: 'The editor just crashed. Content has been reset to the last saved version.',
  42. },
  43. };
  44. global.wagtailVersion = '1.6a1';
  45. global.chooserUrls = {
  46. documentChooser: '/admin/documents/chooser/',
  47. emailLinkChooser: '/admin/choose-email-link/',
  48. embedsChooser: '/admin/embeds/chooser/',
  49. externalLinkChooser: '/admin/choose-external-link/',
  50. imageChooser: '/admin/images/chooser/',
  51. pageChooser: '/admin/choose-page/',
  52. snippetChooser: '/admin/snippets/choose/',
  53. };
  54. const jQueryObj = {
  55. on: jest.fn(),
  56. off: jest.fn(),
  57. };
  58. global.jQuery = () => jQueryObj;