/** * Typing.spec.js * (c) 2015~ Summernote Team * summernote may be freely distributed under the MIT license./ */ /* jshint unused: false */ /* jshint -W101 */ import chai from 'chai'; import $ from 'jquery'; import range from '../../../../src/js/base/core/range'; import Typing from '../../../../src/js/base/editing/Typing'; var expect = chai.expect; describe('base:editing.Style', () => { function typing(level) { return new Typing({ options: { blockquoteBreakingLevel: level } }); } describe('base:editing.Typing', () => { describe('insertParagraph', () => { describe('blockquote breaking support', () => { var $editable; function check(html) { expect($editable.html()).to.equalsIgnoreCase(html); } beforeEach(() => { $editable = $('
Part1Part2.1Part3
Part2.2
Part1'); }); it('should break the first blockquote if blockquoteBreakingLevel=1', () => { typing(1).insertParagraph($editable, range.create($('#2', $editable)[0].firstChild, 1)); check('Part3P
art2.1
Part2.2
Part1'); }); it('should break all blockquotes if blockquoteBreakingLevel=2', () => { typing(2).insertParagraph($editable, range.create($('#2', $editable)[0].firstChild, 1)); check('P
Part3art2.1
Part2.2
Part1P
'); }); it('should remove leading BR from split, when breaking is on the right edge of a line', () => { typing(1).insertParagraph($editable, range.create($('#2', $editable)[0].firstChild, 7)); check('Part3art2.1
Part2.2
Part1'); }); it('should insert new paragraph after the blockquote, if break happens at the end of the blockquote', () => { typing(2).insertParagraph($editable, range.create($('#1', $editable)[0].lastChild, 5)); check('Part2.1
Part3Part2.2
Part1
Part2.1Part3
Part2.2
'); }); }); }); }); });Part1
Part2.1Part3
Part2.2