stubs.js 752 B

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