def testRenderBlockEquation(self): ast = katex.Equation(None, tex=r'y=x') res = self.render(ast, renderer=base.HTMLRenderer()) self.assertHTMLTag(res, 'body', size=1) self.assertHTMLTag(res(0), 'span', size=2, class_='moose-katex-block-equation') self.assertHTMLTag(res(0,0), 'span', size=0, class_='moose-katex-equation table-cell') self.assertHTMLTag(res(0,1), 'script', size=1, string='var element = document.getElementById("None");katex.render("y=x", element, {displayMode:true,throwOnError:false});')
def testRenderInlineEquation(self): ast = katex.Equation(None, tex=r'y=x', inline=True) res = self.render(ast, renderer=base.HTMLRenderer()) self.assertHTMLTag(res, 'body', size=1) self.assertHTMLTag(res(0), 'span', size=1, class_='moose-katex-inline-equation') self.assertHTMLTag( res(0, 0), 'script', size=1, string= 'var element = document.getElementById("None");katex.render("y=x", element, {displayMode:false,throwOnError:false});' )