Skip to content

Commit

Permalink
add tests that mousedown in static math doesn't focus
Browse files Browse the repository at this point in the history
  • Loading branch information
eluberoff committed Dec 16, 2024
1 parent 4979d5a commit 70dae6a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/unit/focusBlur.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,38 @@ suite('focusBlur', function () {
mq.blur();
assertHasFocus(mq, 'math field', 'not');
});

test('static math does not focus on click', function (done) {
var mq = MQ.StaticMath(
$('<span>1234\\times 10^{23}</span>').appendTo('#mock')[0]
);

const clickEvent = new Event('mousedown', {
bubbles: true,
cancelable: true
});

mq.el().dispatchEvent(clickEvent);
setTimeout(function () {
assertHasFocus(mq, 'math field', 'not');
done();
}, 100);
});

test('editable math does focus on click', function (done) {
var mq = MQ.MathField(
$('<span>1234\\times 10^{23}</span>').appendTo('#mock')[0]
);

const clickEvent = new Event('mousedown', {
bubbles: true,
cancelable: true
});

mq.el().dispatchEvent(clickEvent);
setTimeout(function () {
assertHasFocus(mq, 'math field');
done();
}, 100);
});
});

0 comments on commit 70dae6a

Please sign in to comment.