diff --git a/blots/scroll.js b/blots/scroll.js
index 870e1a9572..acb8f78db5 100644
--- a/blots/scroll.js
+++ b/blots/scroll.js
@@ -32,8 +32,8 @@ class Scroll extends Parchment.Scroll {
if (last instanceof CodeBlock) {
last.deleteAt(last.length() - 1, 1);
}
- last.moveChildren(first);
- last.remove();
+ first.moveChildren(last, last.children.head);
+ first.remove();
}
this.optimize();
}
diff --git a/test/unit/blots/block.js b/test/unit/blots/block.js
index 29827cdb37..4a10e0394a 100644
--- a/test/unit/blots/block.js
+++ b/test/unit/blots/block.js
@@ -49,7 +49,7 @@ describe('Block', function() {
it('join lines', function() {
let scroll = this.initialize(Scroll, '
Hello
World!
');
scroll.deleteAt(5, 1);
- expect(scroll.domNode).toEqualHTML('HelloWorld!
');
+ expect(scroll.domNode).toEqualHTML('HelloWorld!
');
});
it('join empty lines', function() {
diff --git a/test/unit/core/editor.js b/test/unit/core/editor.js
index 4a54603d31..ca506a587f 100644
--- a/test/unit/core/editor.js
+++ b/test/unit/core/editor.js
@@ -391,6 +391,12 @@ describe('Editor', function() {
);
expect(this.container).toEqualHTML('0123
56
89
');
});
+
+ it('code', function() {
+ let editor = this.initialize(Editor, { html: '0
1\n23\n
' });
+ editor.applyDelta(new Delta().delete(4).retain(1).delete(2));
+ expect(editor.scroll.domNode.innerHTML).toEqual('2
');
+ });
});
describe('getFormat()', function() {
diff --git a/test/unit/formats/code.js b/test/unit/formats/code.js
index 794ad50f71..e17532a159 100644
--- a/test/unit/formats/code.js
+++ b/test/unit/formats/code.js
@@ -120,15 +120,15 @@ describe('Code', function() {
it('delete merge before', function() {
let editor = this.initialize(Editor, { html: '0123
4567\n
' });
editor.deleteText(4, 1);
- expect(editor.getDelta()).toEqual(new Delta().insert('01234567').insert('\n', { header: 1 }));
- expect(editor.scroll.domNode).toEqualHTML('01234567\n
');
+ expect(editor.getDelta()).toEqual(new Delta().insert('01234567').insert('\n', { 'code-block': true }));
+ expect(editor.scroll.domNode).toEqualHTML('01234567\n
');
});
it('delete merge after', function() {
let editor = this.initialize(Editor, { html: '0123\n
4567
' });
editor.deleteText(4, 1);
- expect(editor.getDelta()).toEqual(new Delta().insert('01234567').insert('\n', { 'code-block': true }));
- expect(editor.scroll.domNode).toEqualHTML('01234567\n
');
+ expect(editor.getDelta()).toEqual(new Delta().insert('01234567').insert('\n', { header: 1 }));
+ expect(editor.scroll.domNode).toEqualHTML('01234567
');
});
it('replace', function() {
diff --git a/test/unit/formats/list.js b/test/unit/formats/list.js
index 964246304e..d304309d5a 100644
--- a/test/unit/formats/list.js
+++ b/test/unit/formats/list.js
@@ -189,13 +189,13 @@ describe('List', function() {
5678
`
);
editor.deleteText(2, 5);
- expect(this.container).toEqualHTML('- 0178
');
+ expect(this.container).toEqualHTML('0178
');
});
it('delete partial', function() {
let editor = this.initialize(Editor, '0123
');
editor.deleteText(2, 5);
- expect(this.container).toEqualHTML('0178
');
+ expect(this.container).toEqualHTML('');
});
it('nested list replacement', function() {
diff --git a/test/unit/modules/clipboard.js b/test/unit/modules/clipboard.js
index 24181f9843..1eaf0ad76a 100644
--- a/test/unit/modules/clipboard.js
+++ b/test/unit/modules/clipboard.js
@@ -23,7 +23,7 @@ describe('Clipboard', function() {
this.quill.clipboard.container.innerHTML = '|';
this.quill.clipboard.onPaste(this.event);
setTimeout(() => {
- expect(this.quill.root).toEqualHTML('01|78
');
+ expect(this.quill.root).toEqualHTML('01|78
');
expect(this.quill.getSelection()).toEqual(new Range(3));
done();
}, 2);