stubs.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. },
  39. };
  40. global.wagtailVersion = '1.6a1';
  41. global.chooserUrls = {
  42. documentChooser: '/admin/documents/chooser/',
  43. emailLinkChooser: '/admin/choose-email-link/',
  44. embedsChooser: '/admin/embeds/chooser/',
  45. externalLinkChooser: '/admin/choose-external-link/',
  46. imageChooser: '/admin/images/chooser/',
  47. pageChooser: '/admin/choose-page/',
  48. snippetChooser: '/admin/snippets/choose/',
  49. };
  50. const jQueryObj = {
  51. on: jest.fn(),
  52. off: jest.fn(),
  53. };
  54. global.jQuery = () => jQueryObj;