mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-08 13:21:56 +00:00
Merge pull request #3588 from overleaf/msm-fix-outline-chat-stories
Fixed Chat and Outline stories GitOrigin-RevId: ff0b0d8c733e7f3fc9a355ecc81c628d15497059
This commit is contained in:
parent
4e40eee738
commit
94e65f16a8
3 changed files with 24 additions and 6 deletions
services/web/frontend/stories
|
@ -7,11 +7,10 @@ import {
|
|||
stubUIConfig,
|
||||
stubMathJax
|
||||
} from '../../test/frontend/features/chat/components/stubs'
|
||||
import { setupContext } from './fixtures/context'
|
||||
|
||||
const ONE_MINUTE = 60 * 1000
|
||||
|
||||
window.project_id = '1234'
|
||||
|
||||
const user = {
|
||||
id: 'fake_user',
|
||||
first_name: 'mortimer',
|
||||
|
@ -45,8 +44,9 @@ function generateMessages(count) {
|
|||
stubUIConfig()
|
||||
stubMathJax()
|
||||
stubChatStore({ user })
|
||||
setupContext()
|
||||
|
||||
export const Conversation = args => <ChatPane {...args} />
|
||||
export const Conversation = args => <ChatPane {...args} chatIsOpen />
|
||||
Conversation.parameters = {
|
||||
setupMocks: () => {
|
||||
fetchMock.restore()
|
||||
|
@ -55,7 +55,7 @@ Conversation.parameters = {
|
|||
}
|
||||
}
|
||||
|
||||
export const NoMessages = args => <ChatPane {...args} />
|
||||
export const NoMessages = args => <ChatPane {...args} chatIsOpen />
|
||||
NoMessages.parameters = {
|
||||
setupMocks: () => {
|
||||
fetchMock.restore()
|
||||
|
@ -63,7 +63,7 @@ NoMessages.parameters = {
|
|||
}
|
||||
}
|
||||
|
||||
export const Loading = args => <ChatPane {...args} />
|
||||
export const Loading = args => <ChatPane {...args} chatIsOpen />
|
||||
Loading.parameters = {
|
||||
setupMocks: () => {
|
||||
fetchMock.restore()
|
||||
|
|
17
services/web/frontend/stories/fixtures/context.js
Normal file
17
services/web/frontend/stories/fixtures/context.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
import sinon from 'sinon'
|
||||
|
||||
export function setupContext() {
|
||||
window.project_id = '1234'
|
||||
let $scope = {}
|
||||
if (window._ide) {
|
||||
$scope = { ...window._ide.$scope, project: {} }
|
||||
}
|
||||
window._ide = {
|
||||
...window._ide,
|
||||
$scope,
|
||||
socket: {
|
||||
on: sinon.stub(),
|
||||
removeListener: sinon.stub()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,8 +2,9 @@ import React from 'react'
|
|||
|
||||
import OutlinePane from '../js/features/outline/components/outline-pane'
|
||||
import { ContextRoot } from '../js/shared/context/root-context'
|
||||
import { setupContext } from './fixtures/context'
|
||||
|
||||
window.project_id = '1234'
|
||||
setupContext()
|
||||
|
||||
export const Basic = args => <OutlinePane {...args} />
|
||||
Basic.args = {
|
||||
|
|
Loading…
Add table
Reference in a new issue