2021-01-21 07:22:28 -05:00
|
|
|
import sinon from 'sinon'
|
|
|
|
|
|
|
|
export function setupContext() {
|
|
|
|
window.project_id = '1234'
|
2021-02-17 05:05:33 -05:00
|
|
|
window.user = {
|
2021-04-27 03:52:58 -04:00
|
|
|
id: 'fake_user',
|
2021-04-30 16:20:16 -04:00
|
|
|
allowedFreeTrial: true,
|
2021-02-17 05:05:33 -05:00
|
|
|
}
|
2021-01-21 07:22:28 -05:00
|
|
|
let $scope = {}
|
|
|
|
if (window._ide) {
|
2021-03-04 09:22:58 -05:00
|
|
|
$scope = {
|
|
|
|
...window._ide.$scope,
|
2021-06-25 04:14:07 -04:00
|
|
|
user: window.user,
|
2021-03-04 09:22:58 -05:00
|
|
|
project: {},
|
|
|
|
$watch: () => {},
|
2021-09-30 07:29:25 -04:00
|
|
|
$applyAsync: () => {},
|
2021-03-04 09:22:58 -05:00
|
|
|
ui: {
|
2021-04-27 03:52:58 -04:00
|
|
|
chatOpen: true,
|
2021-04-28 04:46:39 -04:00
|
|
|
pdfLayout: 'flat',
|
2021-04-27 03:52:58 -04:00
|
|
|
},
|
2021-05-31 04:25:32 -04:00
|
|
|
toggleHistory: () => {},
|
2021-03-04 09:22:58 -05:00
|
|
|
}
|
2021-01-21 07:22:28 -05:00
|
|
|
}
|
|
|
|
window._ide = {
|
|
|
|
...window._ide,
|
|
|
|
$scope,
|
|
|
|
socket: {
|
|
|
|
on: sinon.stub(),
|
2021-04-27 03:52:58 -04:00
|
|
|
removeListener: sinon.stub(),
|
|
|
|
},
|
2021-09-30 07:29:25 -04:00
|
|
|
fileTreeManager: {
|
|
|
|
findEntityByPath: () => null,
|
|
|
|
getRootDocDirname: () => undefined,
|
|
|
|
},
|
2021-01-21 07:22:28 -05:00
|
|
|
}
|
2021-03-31 11:46:43 -04:00
|
|
|
window.ExposedSettings = window.ExposedSettings || {}
|
2021-04-28 04:46:39 -04:00
|
|
|
window.ExposedSettings.appName = 'Overleaf'
|
|
|
|
window.gitBridgePublicBaseUrl = 'https://git.stories.com'
|
2021-01-21 07:22:28 -05:00
|
|
|
}
|