Merge pull request #574 from The-Penultimate-Defenestrator/patch-2
Fix .text() of variables with an exponent (was outputting a `*` between them, like `x*^2`)
diff --git a/src/commands/math/basicSymbols.js b/src/commands/math/basicSymbols.js
index d959c75..a165a8c 100644
--- a/src/commands/math/basicSymbols.js
+++ b/src/commands/math/basicSymbols.js
@@ -29,7 +29,7 @@
&& this[L].ctrlSeq !== "\\ ")
text = '*' + text;
if (this[R] && !(this[R] instanceof BinaryOperator)
- && !(this[R].ctrlSeq === '^'))
+ && !(this[R] instanceof SupSub))
text += '*';
return text;
};
diff --git a/test/unit/publicapi.test.js b/test/unit/publicapi.test.js
index ac0a219..efeb9c2 100644
--- a/test/unit/publicapi.test.js
+++ b/test/unit/publicapi.test.js
@@ -144,6 +144,8 @@
assert.equal(mq.text(), '3^4');
mq.latex('3x+\\ 4');
assert.equal(mq.text(), '3*x+ 4');
+ mq.latex('x^2');
+ assert.equal(mq.text(), 'x^2')
});
test('.moveToDirEnd(dir)', function() {