mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-06 19:58:40 +00:00
Add some basic testing using jasmine
Summary: Make some tests that test the parser. So far, there are no DOM tests, but maybe later. Test Plan: Run `make serve` and then visit `/test/test.html`. Make sure all the tests pass. Reviewers: alpert Reviewed By: alpert Differential Revision: http://phabricator.khanacademy.org/D2987
This commit is contained in:
10
katex.js
10
katex.js
@@ -1,10 +1,4 @@
|
||||
var parser = require("./parser.jison");
|
||||
parser.lexer = require("./lexer");
|
||||
parser.yy = {
|
||||
parseError: function(str) {
|
||||
throw new Error(str);
|
||||
}
|
||||
};
|
||||
var parseTree = require("./parseTree");
|
||||
|
||||
var buildExpression = function(expression) {
|
||||
return _.map(expression, function(ex, i) {
|
||||
@@ -138,7 +132,7 @@ var clearNode = function(node) {
|
||||
};
|
||||
|
||||
var process = function(toParse, baseElem) {
|
||||
var tree = parser.parse(toParse);
|
||||
var tree = parseTree(toParse);
|
||||
clearNode(baseElem);
|
||||
_.each(buildExpression(tree), function(elem) {
|
||||
baseElem.appendChild(elem);
|
||||
|
Reference in New Issue
Block a user