2
0

stubs.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 saved content',
  40. SHOW_LATEST_CONTENT: 'Show latest content',
  41. SHOW_ERROR: 'Show error',
  42. EDITOR_CRASH: 'The editor just crashed. Content has been reset to the last saved version.',
  43. },
  44. };
  45. global.wagtailVersion = '1.6a1';
  46. global.chooserUrls = {
  47. documentChooser: '/admin/documents/chooser/',
  48. emailLinkChooser: '/admin/choose-email-link/',
  49. embedsChooser: '/admin/embeds/chooser/',
  50. externalLinkChooser: '/admin/choose-external-link/',
  51. imageChooser: '/admin/images/chooser/',
  52. pageChooser: '/admin/choose-page/',
  53. snippetChooser: '/admin/snippets/choose/',
  54. };
  55. const jQueryObj = {
  56. on: jest.fn(),
  57. off: jest.fn(),
  58. };
  59. global.jQuery = () => jQueryObj;