0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

Added test cases covering strange IE selections. These fail.

This commit is contained in:
Gert K. Sønderby 2015-10-02 15:02:32 +02:00
parent db8eb7907d
commit 4e33a47401

View file

@ -79,6 +79,15 @@ describe('Squire RTE', function () {
expect(editor.hasFormat('b'), 'to be true');
});
it('returns true when range covers start of format, even in weird cases', function () {
var range = doc.createRange();
var prev = doc.querySelector('b').previousSibling;
range.setStart(prev, prev.length);
range.setEnd(doc.querySelector('b').childNodes[0], 8);
editor.setSelection(range);
expect(editor.hasFormat('b'), 'to be true');
});
it('returns true when range covers end of format', function () {
var range = doc.createRange();
range.setStart(doc.querySelector('b').childNodes[0], 2);
@ -87,6 +96,15 @@ describe('Squire RTE', function () {
expect(editor.hasFormat('b'), 'to be true');
});
it('returns true when range covers end of format, even in weird cases', function () {
var range = doc.createRange();
range.setStart(doc.querySelector('b').childNodes[0], 2);
var next = doc.querySelector('b').nextSibling;
range.setEnd(next, 0);
editor.setSelection(range);
expect(editor.hasFormat('b'), 'to be true');
});
it('returns true when range covers all of format', function () {
var range = doc.createRange();
range.setStartBefore(doc.querySelector('b'));