mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 06:25:28 -05:00
392410390e
File Tree Misc Code Changes GitOrigin-RevId: dce64a5378ecee5c8a2e25e02502ae631d87f36b
69 lines
1.5 KiB
JavaScript
69 lines
1.5 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: {
|
|
features: {},
|
|
rootFolder: [
|
|
{
|
|
_id: 'root-folder-id',
|
|
name: 'rootFolder',
|
|
docs: [],
|
|
folders: [],
|
|
fileRefs: [],
|
|
},
|
|
],
|
|
},
|
|
$watch: () => {},
|
|
$applyAsync: () => {},
|
|
$broadcast: () => {},
|
|
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)
|
|
},
|
|
},
|
|
metadataManager: {
|
|
metadata: {
|
|
state: {
|
|
documents: {},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
window.ExposedSettings = window.ExposedSettings || {}
|
|
window.ExposedSettings.appName = 'Overleaf'
|
|
window.gitBridgePublicBaseUrl = 'https://git.stories.com'
|
|
}
|