overleaf/services/web/frontend/stories/fixtures/context.js
Alf Eaton 913a62fbc8 Migrate synctex controls to React (#5503)
GitOrigin-RevId: 80362a00ae6b73616a6fa9b3193b9b9974b5fd35
2021-10-22 08:03:43 +00:00

50 lines
1.1 KiB
JavaScript

import sinon from 'sinon'
export function setupContext() {
window.project_id = '1234'
window.user = {
id: 'fake_user',
allowedFreeTrial: true,
}
let $scope = {}
if (window._ide) {
$scope = {
...window._ide.$scope,
user: window.user,
project: {},
$watch: () => {},
$applyAsync: () => {},
ui: {
chatOpen: true,
pdfLayout: 'flat',
},
settings: {
pdfViewer: 'js',
},
toggleHistory: () => {},
}
}
window._ide = {
...window._ide,
$scope,
socket: {
on: sinon.stub(),
removeListener: sinon.stub(),
},
fileTreeManager: {
findEntityById: () => null,
findEntityByPath: () => null,
getEntityPath: () => null,
getRootDocDirname: () => undefined,
},
editorManager: {
getCurrentDocId: () => 'foo',
openDoc: (id, options) => {
console.log('open doc', id, options)
},
},
}
window.ExposedSettings = window.ExposedSettings || {}
window.ExposedSettings.appName = 'Overleaf'
window.gitBridgePublicBaseUrl = 'https://git.stories.com'
}