2023-08-29 10:14:04 +00:00
|
|
|
const MATHJAX_STUB = `
|
|
|
|
window.MathJax = {
|
|
|
|
startup: {
|
|
|
|
promise: Promise.resolve()
|
|
|
|
},
|
2023-10-25 11:11:14 +00:00
|
|
|
svgStylesheet: () => document.createElement("STYLE"),
|
|
|
|
typesetPromise: (elements) => {
|
|
|
|
for (const element of elements) {
|
|
|
|
// This will keep math delimeters around the text
|
|
|
|
element.classList.add('MathJax')
|
|
|
|
}
|
|
|
|
return Promise.resolve()
|
|
|
|
},
|
|
|
|
tex2svgPromise: (content) => {
|
|
|
|
const text = document.createElement('SPAN')
|
|
|
|
text.classList.add('MathJax')
|
|
|
|
text.innerText = content
|
|
|
|
return Promise.resolve(text)
|
|
|
|
},
|
|
|
|
getMetricsFor: () => ({}),
|
|
|
|
texReset: () => {},
|
2023-08-29 10:14:04 +00:00
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
export const interceptMathJax = () => {
|
|
|
|
cy.window().then(win => {
|
|
|
|
win.metaAttributesCache.set(
|
|
|
|
'ol-mathJax3Path',
|
2023-10-25 11:11:14 +00:00
|
|
|
'/js/libs/mathjax3/es5/tex-svg-full.js'
|
2023-08-29 10:14:04 +00:00
|
|
|
)
|
|
|
|
})
|
|
|
|
cy.intercept(
|
|
|
|
'GET',
|
2023-10-25 11:11:14 +00:00
|
|
|
'/js/libs/mathjax3/es5/tex-svg-full.js*',
|
2023-08-29 10:14:04 +00:00
|
|
|
MATHJAX_STUB
|
2023-10-25 11:11:14 +00:00
|
|
|
).as('mathjax-load-request')
|
2023-08-29 10:14:04 +00:00
|
|
|
}
|