overleaf/services/web/cypress/support/shared/commands/mathjax.ts

24 lines
538 B
TypeScript
Raw Normal View History

const MATHJAX_STUB = `
window.MathJax = {
startup: {
promise: Promise.resolve()
},
svgStylesheet: () => document.createElement("STYLE")
}
`
export const interceptMathJax = () => {
cy.window().then(win => {
win.metaAttributesCache.set(
'ol-mathJax3Path',
'https://unpkg.com/mathjax@3.2.2/es5/tex-svg-full.js'
)
})
cy.intercept('GET', '/js/libs/mathjax3/es5/tex-svg-full.js*', MATHJAX_STUB)
cy.intercept(
'GET',
'https://unpkg.com/mathjax@3.2.2/es5/tex-svg-full.js',
MATHJAX_STUB
)
}