mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-08 16:00:06 -05:00
Added test cases covering strange IE selections. These fail.
This commit is contained in:
parent
db8eb7907d
commit
4e33a47401
1 changed files with 18 additions and 0 deletions
|
@ -79,6 +79,15 @@ describe('Squire RTE', function () {
|
||||||
expect(editor.hasFormat('b'), 'to be true');
|
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 () {
|
it('returns true when range covers end of format', function () {
|
||||||
var range = doc.createRange();
|
var range = doc.createRange();
|
||||||
range.setStart(doc.querySelector('b').childNodes[0], 2);
|
range.setStart(doc.querySelector('b').childNodes[0], 2);
|
||||||
|
@ -87,6 +96,15 @@ describe('Squire RTE', function () {
|
||||||
expect(editor.hasFormat('b'), 'to be true');
|
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 () {
|
it('returns true when range covers all of format', function () {
|
||||||
var range = doc.createRange();
|
var range = doc.createRange();
|
||||||
range.setStartBefore(doc.querySelector('b'));
|
range.setStartBefore(doc.querySelector('b'));
|
||||||
|
|
Loading…
Reference in a new issue