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
|
|
|
}
|
2022-05-16 04:01:59 -04:00
|
|
|
const $scope = {
|
|
|
|
...window._ide?.$scope,
|
|
|
|
user: window.user,
|
|
|
|
project: {
|
|
|
|
_id: window.project_id,
|
|
|
|
name: 'Project Fake Name',
|
|
|
|
features: {},
|
|
|
|
rootFolder: [
|
|
|
|
{
|
|
|
|
_id: 'root-folder-id',
|
|
|
|
name: 'rootFolder',
|
|
|
|
docs: [],
|
|
|
|
folders: [],
|
|
|
|
fileRefs: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
$watch: () => {},
|
|
|
|
$applyAsync: () => {},
|
|
|
|
$broadcast: () => {},
|
|
|
|
ui: {
|
|
|
|
chatOpen: true,
|
|
|
|
pdfLayout: 'flat',
|
|
|
|
},
|
|
|
|
settings: {
|
|
|
|
pdfViewer: 'js',
|
|
|
|
},
|
|
|
|
toggleHistory: () => {},
|
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: {
|
2021-10-21 06:31:51 -04:00
|
|
|
findEntityById: () => null,
|
2021-09-30 07:29:25 -04:00
|
|
|
findEntityByPath: () => null,
|
2021-10-21 06:31:51 -04:00
|
|
|
getEntityPath: () => null,
|
2021-09-30 07:29:25 -04:00
|
|
|
getRootDocDirname: () => undefined,
|
|
|
|
},
|
2021-10-21 06:31:51 -04:00
|
|
|
editorManager: {
|
|
|
|
getCurrentDocId: () => 'foo',
|
|
|
|
openDoc: (id, options) => {
|
|
|
|
console.log('open doc', id, options)
|
|
|
|
},
|
|
|
|
},
|
2021-11-22 06:24:03 -05:00
|
|
|
metadataManager: {
|
|
|
|
metadata: {
|
|
|
|
state: {
|
|
|
|
documents: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
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'
|
2022-05-16 04:01:59 -04:00
|
|
|
|
|
|
|
window.metaAttributesCache = window.metaAttributesCache || new Map()
|
|
|
|
window.metaAttributesCache.set('ol-user', window.user)
|
2021-01-21 07:22:28 -05:00
|
|
|
}
|