context.js 639 B

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