overleaf/services/web/cypress/support/shared/commands/mathjax.ts
Mathias Jakobsen 28d8c2b135 Merge pull request #14499 from overleaf/mj-table-gen-tests
[visual] Add cypress tests for table generator

GitOrigin-RevId: 03bdd315221f8a5998fd37de4c955635dcc86148
2023-08-30 08:04:40 +00:00

23 lines
538 B
TypeScript

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
)
}