Code coverage report for test/base/editing/Typing.spec.js

# all files / test/base/editing/ Typing.spec.js

100% Statements 37/37
100% Branches 0/0
100% Functions 15/15
100% Lines 36/36

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    601×
    1×

    1×
    1×
    1×
    1×
    1×
    1×
    2×
    6×

    1×
    1×
    1×
    1×
    2×
    6×

    1×
    6×

    1×
    1×
    1×

    1×
    1×
    1×

    1×
    1×
    1×

    1×
    1×
    1×

    1×
    1×
    1×

    1×
    1×
    1×

     (function(global){global.wrappers['/Users/lqez/Dev/summernote/test/base/editing/Typing.spec.js']=[function(require,module,exports,__dirname,__filename){ "use strict";
    exports.__esModule = true;
    /**
     * Typing.spec.js
     * (c) 2015~ Summernote Team
     * summernote may be freely distributed under the MIT license./
     */
    /* jshint unused: false */
    /* jshint -W101 */
    var chai_1 = require("chai");
    var jquery_1 = require("jquery");
    var range_1 = require("../../../src/js/base/core/range");
    var Typing_1 = require("../../../src/js/base/editing/Typing");
    var expect = chai_1["default"].expect;
    describe('base:editing.Style', function () {
        function typing(level) {
            return new Typing_1["default"]({ options: { blockquoteBreakingLevel: level } });
        }
        describe('base:editing.Typing', function () {
            describe('insertParagraph', function () {
                describe('blockquote breaking support', function () {
                    var $editable;
                    function check(html) {
                        expect($editable.html()).to.equalsIgnoreCase(html);
                    }
                    beforeEach(function () {
                        $editable = jquery_1["default"]('<div class="note-editable"><blockquote id="1">Part1<blockquote id="2">Part2.1<br>Part2.2</blockquote>Part3</blockquote></div>');
                    });
                    it('should not break blockquote if blockquoteBreakingLevel=0', function () {
                        typing(0).insertParagraph($editable, range_1["default"].create(jquery_1["default"]('#2', $editable)[0].firstChild, 1));
                        check('<blockquote id="1">Part1<blockquote id="2"><p>P</p><p>art2.1<br>Part2.2</p></blockquote>Part3</blockquote>');
                    });
                    it('should break the first blockquote if blockquoteBreakingLevel=1', function () {
                        typing(1).insertParagraph($editable, range_1["default"].create(jquery_1["default"]('#2', $editable)[0].firstChild, 1));
                        check('<blockquote id="1">Part1<blockquote id="2"><p>P</p></blockquote><p><br></p><blockquote id="2"><p>art2.1<br>Part2.2</p></blockquote>Part3</blockquote>');
                    });
                    it('should break all blockquotes if blockquoteBreakingLevel=2', function () {
                        typing(2).insertParagraph($editable, range_1["default"].create(jquery_1["default"]('#2', $editable)[0].firstChild, 1));
                        check('<blockquote id="1">Part1<blockquote id="2"><p>P</p></blockquote></blockquote><p><br></p><blockquote id="1"><blockquote id="2"><p>art2.1<br>Part2.2</p></blockquote>Part3</blockquote>');
                    });
                    it('should remove leading BR from split, when breaking is on the right edge of a line', function () {
                        typing(1).insertParagraph($editable, range_1["default"].create(jquery_1["default"]('#2', $editable)[0].firstChild, 7));
                        check('<blockquote id="1">Part1<blockquote id="2"><p>Part2.1</p></blockquote><p><br></p><blockquote id="2"><p>Part2.2</p></blockquote>Part3</blockquote>');
                    });
                    it('should insert new paragraph after the blockquote, if break happens at the end of the blockquote', function () {
                        typing(2).insertParagraph($editable, range_1["default"].create(jquery_1["default"]('#1', $editable)[0].lastChild, 5));
                        check('<blockquote id="1"><p>Part1<blockquote id="2">Part2.1<br>Part2.2</blockquote>Part3</p></blockquote><p><br></p>');
                    });
                    it('should insert new paragraph before the blockquote, if break happens at the beginning of the blockquote', function () {
                        typing(2).insertParagraph($editable, range_1["default"].create(jquery_1["default"]('#1', $editable)[0].firstChild, 0));
                        check('<p><br></p><blockquote id="1"><p>Part1<blockquote id="2">Part2.1<br>Part2.2</blockquote>Part3</p></blockquote>');
                    });
                });
            });
        });
    });

    },'test/base/editing/Typing.spec.js',{"chai":"/Users/lqez/Dev/summernote/node_modules/chai/index.js","jquery":"/Users/lqez/Dev/summernote/node_modules/jquery/dist/jquery.js","../../../src/js/base/core/range":"/Users/lqez/Dev/summernote/src/js/base/core/range.js","../../../src/js/base/editing/Typing":"/Users/lqez/Dev/summernote/src/js/base/editing/Typing.js"}];})(this);
    //# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 7352 characters]