context.js 698 B

123456789101112131415161718192021222324252627282930313233
  1. import sinon from 'sinon'
  2. export function setupContext() {
  3. window.project_id = '1234'
  4. window.user = {
  5. id: 'fake_user',
  6. allowedFreeTrial: true,
  7. }
  8. let $scope = {}
  9. if (window._ide) {
  10. $scope = {
  11. ...window._ide.$scope,
  12. project: {},
  13. $watch: () => {},
  14. ui: {
  15. chatOpen: true,
  16. pdfLayout: 'flat',
  17. },
  18. toggleHistory: () => {},
  19. }
  20. }
  21. window._ide = {
  22. ...window._ide,
  23. $scope,
  24. socket: {
  25. on: sinon.stub(),
  26. removeListener: sinon.stub(),
  27. },
  28. }
  29. window.ExposedSettings = window.ExposedSettings || {}
  30. window.ExposedSettings.appName = 'Overleaf'
  31. window.gitBridgePublicBaseUrl = 'https://git.stories.com'
  32. }