Code coverage report for test/base/module/VideoDialog.spec.js

# all files / test/base/module/ VideoDialog.spec.js

100% Statements 36/36
100% Branches 0/0
100% Functions 9/9
100% Lines 35/35

    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
    571×
    1×

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

    1×
    1×
    3×
    3×
    3×

    3×
    3×
    3×

    1×
    1×
    1×
    1×
    1×

    1×

    1×

    1×

    1×
    1×

    1×

    1×
    1×

     (function(global){global.wrappers['/Users/lqez/Dev/summernote/test/base/module/VideoDialog.spec.js']=[function(require,module,exports,__dirname,__filename){ "use strict";
    exports.__esModule = true;
    /**
     * VideoDialog.spec.js
     * (c) 2015~ Summernote Team
     * summernote may be freely distributed under the MIT license./
     */
    var chai_1 = require("chai");
    var jquery_1 = require("jquery");
    var Context_1 = require("../../../src/js/base/Context");
    var VideoDialog_1 = require("../../../src/js/base/module/VideoDialog");
    require("../../../src/js/bs4/settings");
    describe('VideoDialog', function () {
        var expect = chai_1["default"].expect;
        function expectUrl(source, target) {
            var iframe = $video.createVideoNode(source);
            expect(iframe).to.not.equal(false);
            expect(iframe.tagName).to.equal('IFRAME');
            expect(iframe.src).to.be.have.string(target);
        }
        var context, $video;
        beforeEach(function () {
            var $note = jquery_1["default"]('<div></div>').appendTo('body');
            var options = jquery_1["default"].extend({}, jquery_1["default"].summernote.options);
            options.toolbar = [
                ['video', ['video']],
            ];
            context = new Context_1["default"]($note, options);
            context.initialize();
            $video = new VideoDialog_1["default"](context);
        });
        describe('#createVideoNode', function () {
            it('should get false when insert invalid urls', function () {
                expect($video.createVideoNode('http://www.google.com')).to.equal(false);
                expect($video.createVideoNode('http://www.youtube.com')).to.equal(false);
                expect($video.createVideoNode('http://www.facebook.com')).to.equal(false);
            });
            it('should get proper iframe src when insert valid video urls', function () {
                // YouTube
                expectUrl('https://www.youtube.com/watch?v=jNQXAC9IVRw', '//www.youtube.com/embed/jNQXAC9IVRw');
                // Instagram
                expectUrl('https://www.instagram.com/p/Bi9cbsxjn-F', '//instagram.com/p/Bi9cbsxjn-F/embed/');
                // v.qq.com
                expectUrl('http://v.qq.com/cover/6/640ewqy2v071ppd.html?vid=f0196y2b2cx', '//v.qq.com/iframe/player.html?vid=f0196y2b2cx&amp;auto=0');
                expectUrl('http://v.qq.com/x/page/p0330y279lm.html', '//v.qq.com/iframe/player.html?vid=p0330y279lm&amp;auto=0');
                // Facebook
                expectUrl('https://www.facebook.com/Engineering/videos/631826881803/', '//www.facebook.com/plugins/video.php?href=www.facebook.com%2FEngineering%2Fvideos%2F631826881803');
            });
            it('should be embedded start parameter when insert YouTube video with t', function () {
                expectUrl('https://youtu.be/wZZ7oFKsKzY?t=4h2m42s', '//www.youtube.com/embed/wZZ7oFKsKzY?start=14562');
            });
        });
    });

    },'test/base/module/VideoDialog.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/Context":"/Users/lqez/Dev/summernote/src/js/base/Context.js","../../../src/js/base/module/VideoDialog":"/Users/lqez/Dev/summernote/src/js/base/module/VideoDialog.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, 5736 characters]