Code coverage report for test/base/Context.spec.js

# all files / test/base/ Context.spec.js

100% Statements 53/53
50% Branches 1/2
100% Functions 10/10
100% Lines 52/52

    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
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    741×
    1×

    1×
    1×

    1×
    1×
    1×
    1×
    1×
    1×
    1×

    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×

    1×
    1×
    1×

    1×
    1×
    1×
    1×
    1×
    1×
    1×
    1×

    1×
    1×
    1×
    3×

    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/Context.spec.js']=[function(require,module,exports,__dirname,__filename){ "use strict";
    exports.__esModule = true;
    /**
     * Context.spec.js
     * (c) 2015~ Summernote Team
     * summernote may be freely distributed under the MIT license./
     */
    var chai_1 = require("chai");
    var chai_spies_1 = require("chai-spies");
    /* eslint-disable import/first */
    var jquery_1 = require("jquery");
    window.jQuery = jquery_1["default"];
    require("bootstrap");
    var chaidom_1 = require("../chaidom");
    var env_1 = require("../../src/js/base/core/env");
    var Context_1 = require("../../src/js/base/Context");
    require("../../src/js/bs4/settings");
    /* eslint-enable import/first */
    var expect = chai_1["default"].expect;
    chai_1["default"].use(chai_spies_1["default"]);
    chai_1["default"].use(chaidom_1["default"]);
    describe('Context lifecycle', function () {
        it('should be initialized without calling callback', function () {
            var spy = chai_1["default"].spy();
            var $note = jquery_1["default"]('<div><p>hello</p></div>');
            $note.on('summernote.change', spy);
            var context = new Context_1["default"]($note, jquery_1["default"].summernote.options);
            expect(spy).to.have.not.been.called();
            // [workaround]
            //  - IE8-11 can't create range in headless mode
            Eif (!env_1["default"].isMSIE) {
                context.invoke('insertText', 'hello');
                expect(spy).to.have.been.called();
            }
        });
        it('should preserve user events handler after destroy', function () {
            var spy = chai_1["default"].spy();
            var $note = jquery_1["default"]('<div><p>hello</p></div>');
            $note.on('click', spy);
            var context = new Context_1["default"]($note, jquery_1["default"].summernote.options);
            context.destroy();
            $note.trigger('click');
            expect(spy).to.have.been.called();
        });
    });
    describe('Context', function () {
        var context;
        beforeEach(function () {
            context = new Context_1["default"](jquery_1["default"]('<div><p>hello</p></div>'), jquery_1["default"].summernote.options);
        });
        it('should get or set contents with code', function () {
            expect(context.code()).to.equalsIgnoreCase('<p>hello</p>');
            context.code('<p>hello2</p>');
            expect(context.code()).to.equalsIgnoreCase('<p>hello2</p>');
        });
        it('should enable or disable editor', function () {
            expect(context.isDisabled()).to.be["false"];
            context.disable();
            expect(context.isDisabled()).to.be["true"];
            context.enable();
            expect(context.isDisabled()).to.be["false"];
        });
        it('should preserve disabled status after reset', function () {
            expect(context.isDisabled()).to.be["false"];
            context.disable();
            expect(context.isDisabled()).to.be["true"];
            context.reset();
            expect(context.isDisabled()).to.be["true"];
        });
    });

    },'test/base/Context.spec.js',{"chai":"/Users/lqez/Dev/summernote/node_modules/chai/index.js","chai-spies":"/Users/lqez/Dev/summernote/node_modules/chai-spies/chai-spies.js","jquery":"/Users/lqez/Dev/summernote/node_modules/jquery/dist/jquery.js","bootstrap":"/Users/lqez/Dev/summernote/node_modules/bootstrap/dist/js/bootstrap.js","../chaidom":"/Users/lqez/Dev/summernote/test/chaidom.js","../../src/js/base/core/env":"/Users/lqez/Dev/summernote/src/js/base/core/env.js","../../src/js/base/Context":"/Users/lqez/Dev/summernote/src/js/base/Context.js","../../src/js/bs4/settings":"/Users/lqez/Dev/summernote/src/js/bs4/settings.js"}];})(this);
    //# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 6596 characters]