mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
864a75c284
* Fixed unread message count in react chat The problem was caused by ChatStore being instantiated multiple times on each `useRef` call, plus also incorrectly cleaned-up, since it should be calling `socket.removeListener` instead of `socket.off` on effect destroy. * deferred loading messages until chat is opened GitOrigin-RevId: b990cd06cea6630472b0911b56219766717aaff6
37 lines
763 B
JavaScript
37 lines
763 B
JavaScript
import sinon from 'sinon'
|
|
|
|
export function stubUIConfig() {
|
|
window.uiConfig = {
|
|
chatMessageBorderSaturation: '85%',
|
|
chatMessageBorderLightness: '40%',
|
|
chatMessageBgSaturation: '85%',
|
|
chatMessageBgLightness: '40%'
|
|
}
|
|
}
|
|
|
|
export function tearDownUIConfigStubs() {
|
|
delete window.uiConfig
|
|
}
|
|
|
|
export function stubMathJax() {
|
|
window.MathJax = {
|
|
Hub: {
|
|
Queue: sinon.stub(),
|
|
config: { tex2jax: { inlineMath: [['$', '$']] } }
|
|
}
|
|
}
|
|
}
|
|
|
|
export function tearDownMathJaxStubs() {
|
|
delete window.MathJax
|
|
}
|
|
|
|
export function stubChatStore({ user }) {
|
|
window._ide = { socket: { on: sinon.stub(), removeListener: sinon.stub() } }
|
|
window.user = user
|
|
}
|
|
|
|
export function tearDownChatStore() {
|
|
delete window._ide
|
|
delete window.user
|
|
}
|