From 4e33a47401f0980bc63546585b7b32c43aebda42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gert=20K=2E=20S=C3=B8nderby?= Date: Fri, 2 Oct 2015 15:02:32 +0200 Subject: [PATCH] Added test cases covering strange IE selections. These fail. --- test/squire.spec.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/squire.spec.js b/test/squire.spec.js index 2b3ff9e..52cf70f 100644 --- a/test/squire.spec.js +++ b/test/squire.spec.js @@ -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'));