stubs.js 869 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import sinon from 'sinon'
  2. import { resetChatStore } from '../../../../../frontend/js/features/chat/store/chat-store-effect'
  3. export function stubUIConfig() {
  4. window.uiConfig = {
  5. chatMessageBorderSaturation: '85%',
  6. chatMessageBorderLightness: '40%',
  7. chatMessageBgSaturation: '85%',
  8. chatMessageBgLightness: '40%'
  9. }
  10. }
  11. export function tearDownUIConfigStubs() {
  12. delete window.uiConfig
  13. }
  14. export function stubMathJax() {
  15. window.MathJax = {
  16. Hub: {
  17. Queue: sinon.stub(),
  18. config: { tex2jax: { inlineMath: [['$', '$']] } }
  19. }
  20. }
  21. }
  22. export function tearDownMathJaxStubs() {
  23. delete window.MathJax
  24. }
  25. export function stubChatStore({ user }) {
  26. window._ide = { socket: { on: sinon.stub(), off: sinon.stub() } }
  27. window.user = user
  28. resetChatStore()
  29. }
  30. export function tearDownChatStore() {
  31. delete window._ide
  32. delete window.user
  33. }