<commit_before>/// <reference path="../src/definitions/Jasmine.d.ts" />
/// <reference path="../src/ts/MapEndOfVideoOptionsToOverlay.ts" />
/// <chutzpah_reference path="../bower_components/jquery/jquery.min.js" />
/// <chutzpah_reference path="../bower_components/videojs-plugin-components/vjsplugincomponents.js" />
describe("MapEndOfVideoOptionsToOverlayTests", () => {
    it("Returns expected values for default input", () => {
        var annotationText = "Basic Annotation";
        var templateName = "Basic Annotation";
        var options: AtlantisJS.IEndOfVideoOptions = {
            callToAction: {
                title: "hello",
                subtitle: "world",
                button: {
                    text: "button",
                    link: "http://www.atlantis.js"
                }
            },
            relatedVideos: {
                title: "Related Videos",
                items: [{
                    title: "New Video",
                    img: "http://www.atlantis.js/img1.png"
                }]
            },
            template: templateName
        };


        var output = AtlantisJS.MapEndOfVideoOptionsToOverlay(options);

        expect(output.template.name).toBe(templateName);
        expect(output.model).toBe(options);
        expect(output.displayTimes[0].start(5)).toBe(4.9);
        expect(output.displayTimes[0].end(5)).toBe(5.1);
    });

    it("Returns expected values for no specified template all set", () => {
        var annotationText = "Basic Annotation";
        var options: AtlantisJS.IEndOfVideoOptions = {
            callToAction: {
                title: "hello",
                subtitle: "world",
                button: {
                    text: "button",
                    link: "http://www.atlantis.js"
                }
            },
            relatedVideos: {
                title: "Related Videos",
                items: [{
                    title: "New Video",
                    img: "http://www.atlantis.js/img1.png"
                }]
            },
        };


        var output = AtlantisJS.MapEndOfVideoOptionsToOverlay(options);

        expect(output.template.name).toBe("ajsEndOfVideoDefault");
        expect(output.model).toBe(options);
        expect(output.displayTimes[0].start(5)).toBe(4.9);
        expect(output.displayTimes[0].end(5)).toBe(5.1);
    });

    it("Returns expected values for no specified template all set", () => {
        var annotationText = "Basic Annotation";
        var options: AtlantisJS.IEndOfVideoOptions = {
            relatedVideos: {
                title: "Related Videos",
                items: [{
                    title: "New Video",
                    img: "http://www.atlantis.js/img1.png"
                }]
            },
        };


        var output = AtlantisJS.MapEndOfVideoOptionsToOverlay(options);

        expect(output.template.name).toBe("ajsEndOfVideoRelatedVideosDefault");
        expect(output.model).toBe(options);
        expect(output.displayTimes[0].start(5)).toBe(4.9);
        expect(output.displayTimes[0].end(5)).toBe(5.1);
    });

    it("Returns expected values for no specified template all set", () => {
        var annotationText = "Basic Annotation";
        var options: AtlantisJS.IEndOfVideoOptions = {
            callToAction: {
                title: "hello",
                subtitle: "world",
                button: {
                    text: "button",
                    link: "http://www.atlantis.js"
                }
            }
        };


        var output = AtlantisJS.MapEndOfVideoOptionsToOverlay(options);

        expect(output.template.name).toBe("ajsEndOfVideoCallToActionDefault");
        expect(output.model).toBe(options);
        expect(output.displayTimes[0].start(5)).toBe(4.9);
        expect(output.displayTimes[0].end(5)).toBe(5.1);
    });

    it("adds video change functionality to related videos", () => {
        var annotationText = "Basic Annotation";
        var templateName = "Basic Annotation";
        var options: AtlantisJS.IEndOfVideoOptions = {
            callToAction: {
                title: "hello",
                subtitle: "world",
                button: {
                    text: "button",
                    link: "http://www.atlantis.js"
                }
            },
            relatedVideos: {
                title: "Related Videos",
                items: [{
                    title: "New Video",
                    img: "http://www.atlantis.js/img1.png",
                    linkId: "videoA"
                }]
            },
            template: templateName
        };


        var output = AtlantisJS.MapEndOfVideoOptionsToOverlay(options);
        var doc = jQuery(document.body);
        doc.append("<a id='testVideoChange' data-video-change='videoA'><div></div></a>");
        var testElement = jQuery("#testVideoChange");
        var childSpy = jasmine.createSpy("player.children");
        childSpy["serviceName"] = "changeVideoByIdFunc";

        output.events["onCreate"][0]({
            overlay: {
                layer: {
                    container: doc
                }
            },
            player: {
                children: jasmine.createSpy("player.children").andReturn([ childSpy ])
            }

        });

        testElement.trigger("click");
        expect(childSpy).toHaveBeenCalledWith("videoA");
        expect(output.template.name).toBe(templateName);
        expect(output.model).toBe(options);
        expect(output.displayTimes[0].start(5)).toBe(4.9);
        expect(output.displayTimes[0].end(5)).toBe(5.1);
    });
});<commit_msg>remove test for time being<commit_after>/// <reference path="../src/definitions/Jasmine.d.ts" />
/// <reference path="../src/ts/MapEndOfVideoOptionsToOverlay.ts" />
/// <chutzpah_reference path="../bower_components/jquery/jquery.min.js" />
/// <chutzpah_reference path="../bower_components/videojs-plugin-components/vjsplugincomponents.js" />
describe("MapEndOfVideoOptionsToOverlayTests", () => {
    it("Returns expected values for default input", () => {
        var annotationText = "Basic Annotation";
        var templateName = "Basic Annotation";
        var options: AtlantisJS.IEndOfVideoOptions = {
            callToAction: {
                title: "hello",
                subtitle: "world",
                button: {
                    text: "button",
                    link: "http://www.atlantis.js"
                }
            },
            relatedVideos: {
                title: "Related Videos",
                items: [{
                    title: "New Video",
                    img: "http://www.atlantis.js/img1.png"
                }]
            },
            template: templateName
        };


        var output = AtlantisJS.MapEndOfVideoOptionsToOverlay(options);

        expect(output.template.name).toBe(templateName);
        expect(output.model).toBe(options);
        expect(output.displayTimes[0].start(5)).toBe(4.9);
        expect(output.displayTimes[0].end(5)).toBe(5.1);
    });

    it("Returns expected values for no specified template all set", () => {
        var annotationText = "Basic Annotation";
        var options: AtlantisJS.IEndOfVideoOptions = {
            callToAction: {
                title: "hello",
                subtitle: "world",
                button: {
                    text: "button",
                    link: "http://www.atlantis.js"
                }
            },
            relatedVideos: {
                title: "Related Videos",
                items: [{
                    title: "New Video",
                    img: "http://www.atlantis.js/img1.png"
                }]
            },
        };


        var output = AtlantisJS.MapEndOfVideoOptionsToOverlay(options);

        expect(output.template.name).toBe("ajsEndOfVideoDefault");
        expect(output.model).toBe(options);
        expect(output.displayTimes[0].start(5)).toBe(4.9);
        expect(output.displayTimes[0].end(5)).toBe(5.1);
    });

    it("Returns expected values for no specified template all set", () => {
        var annotationText = "Basic Annotation";
        var options: AtlantisJS.IEndOfVideoOptions = {
            relatedVideos: {
                title: "Related Videos",
                items: [{
                    title: "New Video",
                    img: "http://www.atlantis.js/img1.png"
                }]
            },
        };


        var output = AtlantisJS.MapEndOfVideoOptionsToOverlay(options);

        expect(output.template.name).toBe("ajsEndOfVideoRelatedVideosDefault");
        expect(output.model).toBe(options);
        expect(output.displayTimes[0].start(5)).toBe(4.9);
        expect(output.displayTimes[0].end(5)).toBe(5.1);
    });

    it("Returns expected values for no specified template all set", () => {
        var annotationText = "Basic Annotation";
        var options: AtlantisJS.IEndOfVideoOptions = {
            callToAction: {
                title: "hello",
                subtitle: "world",
                button: {
                    text: "button",
                    link: "http://www.atlantis.js"
                }
            }
        };


        var output = AtlantisJS.MapEndOfVideoOptionsToOverlay(options);

        expect(output.template.name).toBe("ajsEndOfVideoCallToActionDefault");
        expect(output.model).toBe(options);
        expect(output.displayTimes[0].start(5)).toBe(4.9);
        expect(output.displayTimes[0].end(5)).toBe(5.1);
    });

    // it("adds video change functionality to related videos", () => {
        // var annotationText = "Basic Annotation";
        // var templateName = "Basic Annotation";
        // var options: AtlantisJS.IEndOfVideoOptions = {
            // callToAction: {
                // title: "hello",
                // subtitle: "world",
                // button: {
                    // text: "button",
                    // link: "http://www.atlantis.js"
                // }
            // },
            // relatedVideos: {
                // title: "Related Videos",
                // items: [{
                    // title: "New Video",
                    // img: "http://www.atlantis.js/img1.png",
                    // linkId: "videoA"
                // }]
            // },
            // template: templateName
        // };


        // var output = AtlantisJS.MapEndOfVideoOptionsToOverlay(options);
        // var doc = jQuery(document.body);
        // doc.append("<a id='testVideoChange' data-video-change='videoA'><div></div></a>");
        // var testElement = jQuery("#testVideoChange");
        // var childSpy = jasmine.createSpy("player.children");
        // childSpy["serviceName"] = "changeVideoByIdFunc";

        // output.events["onCreate"][0]({
            // overlay: {
                // layer: {
                    // container: doc
                // }
            // },
            // player: {
                // children: jasmine.createSpy("player.children").andReturn([ childSpy ])
            // }

        // });

        // testElement.trigger("click");
        // expect(childSpy).toHaveBeenCalledWith("videoA");
        // expect(output.template.name).toBe(templateName);
        // expect(output.model).toBe(options);
        // expect(output.displayTimes[0].start(5)).toBe(4.9);
        // expect(output.displayTimes[0].end(5)).toBe(5.1);
    // });
});
{'fraction_non_alphanumeric': 0.1397868250917351, 'fraction_numerical': 0.0078630089114101, 'mean_word_length': 1.6351289134438305, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 16, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4141744', 'n_tokens_mistral': 3258, 'n_tokens_neox': 3018, 'n_words': 482}