forked from mathquill/mathquill
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfab552
commit 13b6c44
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
suite('infixOperatorNames', function () { | ||
const $ = window.test_only_jquery; | ||
var mq; | ||
setup(function () { | ||
const autoOperatorNames = 'arcsinh sin with for'; | ||
const infixOperatorNames = 'with for'; | ||
const opts = { autoOperatorNames, infixOperatorNames }; | ||
mq = MQ.MathField($('<span></span>').appendTo('#mock')[0], opts); | ||
}); | ||
|
||
function prayWellFormedPoint(pt) { | ||
prayWellFormed(pt.parent, pt[L], pt[R]); | ||
} | ||
function assertLatex(latex) { | ||
prayWellFormedPoint(mq.__controller.cursor); | ||
assert.equal(mq.latex(), latex); | ||
} | ||
|
||
test('for stops scanning', function () { | ||
mq.typedText('tfor1/'); | ||
assertLatex('t\\operatorname{for}\\frac{1}{ }'); | ||
}); | ||
|
||
test('sin does not stop scanning', function () { | ||
mq.typedText('tsin1/'); | ||
assertLatex('\\frac{t\\sin1}{ }'); | ||
}); | ||
|
||
test('arcsinh does not stop scanning', function () { | ||
mq.typedText('tarcsinh1/'); | ||
assertLatex('\\frac{t\\operatorname{arcsinh}1}{ }'); | ||
}); | ||
|
||
test('backspace invalidates word', function () { | ||
mq.typedText('tfor1'); | ||
mq.keystroke('Home').keystroke('Right').keystroke('Del'); | ||
assertLatex('tor1'); | ||
mq.keystroke('End').typedText('/'); | ||
assertLatex('\\frac{tor1}{ }'); | ||
}); | ||
}); |