overleaf/services/web/test/frontend/components/editor-left-menu/scope.tsx
M Fahru 7bbf7baf03 Add cypress tests for editor left menu react (#10902)
GitOrigin-RevId: b24021911c85eb689519ff7a6f2b0ea7cbc4a574
2023-07-17 10:26:45 +00:00

54 lines
1,015 B
TypeScript

import { MainDocument, PdfViewer } from '../../../../types/project-settings'
type Scope = {
settings?: {
syntaxValidation?: boolean
pdfViewer?: PdfViewer
}
editor?: {
sharejs_doc?: {
doc_id?: string
getSnapshot?: () => string
}
newSourceEditor?: boolean
}
hasLintingError?: boolean
ui?: {
view?: 'editor' | 'history' | 'file' | 'pdf'
pdfLayout?: 'flat' | 'sideBySide' | 'split'
leftMenuShown?: boolean
}
project?: {
members?: any[]
owner: {
_id: string
}
}
user?: {
features?: {
dropbox: boolean
}
}
docs?: MainDocument[]
}
export const mockScope = (scope?: Scope) => ({
settings: {
syntaxValidation: false,
pdfViewer: 'pdfjs',
},
editor: {
sharejs_doc: {
doc_id: 'test-doc',
getSnapshot: () => 'some doc content',
},
newSourceEditor: true,
},
hasLintingError: false,
ui: {
view: 'editor',
pdfLayout: 'sideBySide',
leftMenuShown: false,
},
...scope,
})