import Scroll from '../../../blots/scroll';
describe('Block', function() {
it('childless', function() {
const scroll = this.initialize(Scroll, '');
const block = scroll.create('block');
block.optimize();
expect(block.domNode).toEqualHTML('
');
});
it('insert into empty', function() {
const scroll = this.initialize(Scroll, '');
const block = scroll.create('block');
block.insertAt(0, 'Test');
expect(block.domNode).toEqualHTML('Test');
});
it('insert newlines', function() {
const scroll = this.initialize(Scroll, '
Hello World!
'); scroll.insertAt(6, 'pardon\nthis\n\ninterruption\n'); expect(scroll.domNode).toEqualHTML(`Hello pardon
this
interruption
World!
`); }); it('insert into formatted', function() { const scroll = this.initialize(Scroll, 'Hello
World!
'); scroll.deleteAt(0, 5); expect(scroll.domNode).toEqualHTML('World!
'); }); it('join lines', function() { const scroll = this.initialize(Scroll, 'HelloWorld
HelloWorld
'); }); it('join empty lines', function() { const scroll = this.initialize(Scroll, 'Test
'); scroll.children.head.domNode.appendChild(document.createElement('br')); scroll.update(); expect(scroll.domNode).toEqualHTML('Test
'); }); });