Commit 945ce5ca authored by Robert Knight's avatar Robert Knight

Add test case for range with no parent element

parent c5f246fb
......@@ -150,6 +150,17 @@ describe('annotator/highlighter', () => {
assert.deepEqual(highlights, []);
});
it('handles a range with no parent element', () => {
const text = document.createTextNode('foobar');
const range = new Range();
range.setStart(text, 0);
range.setEnd(text, text.data.length);
const highlights = highlightRange(range);
assert.deepEqual(highlights, []);
});
it('wraps multiple text nodes which are not adjacent', () => {
const strings = ['hello', ' Brave ', ' New ', ' World'];
const textNodes = strings.map(s => document.createTextNode(s));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment