<commit_before>describe('cat-delay directive', () => {
    let element,
        scope = {},
        catAnimationLink,
        catBaseAnimation,
        catDelayS,
        sandbox,
        template = `
            <div>
                <div
                    cat-delay="300"
                    cat-active="visible"
                    cat-status="status"
                    cat-animation-name="animation-name"
                ></div>
            </div>
            `,
        compile,
        timelineController = {
            register() {
                return;
            }
        },
        $timeout;


    beforeEach(function() {
        sandbox = sinon.sandbox.create();
    });


    beforeEach(angular.mock.module('cat.animations.baseAnimation', function($provide) {
        $provide.decorator('catBaseAnimation', function($delegate) {
                return sandbox.spy($delegate);
        });
    }));

    beforeEach(angular.mock.module('cat.animations.animationLink', function($provide) {
        $provide.decorator('catAnimationLink', function($delegate) {
                return sandbox.spy($delegate);
        });
    }));

    beforeEach(angular.mock.module('cat.utils.delay', function($provide) {
        $provide.decorator('catDelayS', function($delegate) {
                return sandbox.spy($delegate);
        });
    }));

    beforeEach(angular.mock.module('cat.animations.delay'));
    beforeEach(angular.mock.module('ngAnimateMock'));

    beforeEach(angular.mock.inject(($compile, $rootScope, _$timeout_, _catAnimationLink_, _catBaseAnimation_, _catDelayS_) => {
        scope = $rootScope.$new();
        catAnimationLink =  _catAnimationLink_;
        catBaseAnimation =  _catBaseAnimation_;
        catDelayS = _catDelayS_;
        scope.visible = false;
        compile = () => {
            let parentElement = angular.element(template);
            parentElement.data('$catTimelineController', timelineController);
            $compile(parentElement)(scope);
            element = parentElement.children();
            scope.$apply();
        };

        $timeout = _$timeout_;
    }));

    afterEach(() => {
        sandbox.restore();
    });

    it('should set the status to READY if variable is binded', () => {
        compile();
        scope.status.should.equal('READY');
    });

    it('should register itself on the catTimeline parent controller', () => {
        sinon.spy(timelineController, 'register');
        compile();
        timelineController.register.should.have.been.calledOnce;
        timelineController.register.should.have.been.calledWith('animation-name', element.controller('catDelay'));
    });

    describe('#Linking Function', () => {
        it('Should call catAnimationLink function', () => {
            compile();
            catAnimationLink.should.have.been.calledOnce;
        });
    });

    describe('controller', () => {
        let controller;

        beforeEach(() => {
            compile();
            controller = element.controller('catDelay');
        });

        it('Should use catBaseAnimation', () => {
            catBaseAnimation.should.have.been.calledOnce;
        });

        it('Should pass scope catBaseAnimation', () => {
            var config;
            config = catBaseAnimation.args[0][0];
            config.$scope.should.equal(scope);
        });

        it('Should pass catBaseAnimation a config with defined onPlay and attrs', () => {<commit_msg>Minor cap change #41<commit_after>describe('cat-delay directive', () => {
    let element,
        scope = {},
        catAnimationLink,
        catBaseAnimation,
        catDelayS,
        sandbox,
        template = `
            <div>
                <div
                    cat-delay="300"
                    cat-active="visible"
                    cat-status="status"
                    cat-animation-name="animation-name"
                ></div>
            </div>
            `,
        compile,
        timelineController = {
            register() {
                return;
            }
        },
        $timeout;


    beforeEach(function() {
        sandbox = sinon.sandbox.create();
    });


    beforeEach(angular.mock.module('cat.animations.baseAnimation', function($provide) {
        $provide.decorator('catBaseAnimation', function($delegate) {
                return sandbox.spy($delegate);
        });
    }));

    beforeEach(angular.mock.module('cat.animations.animationLink', function($provide) {
        $provide.decorator('catAnimationLink', function($delegate) {
                return sandbox.spy($delegate);
        });
    }));

    beforeEach(angular.mock.module('cat.utils.delay', function($provide) {
        $provide.decorator('catDelayS', function($delegate) {
                return sandbox.spy($delegate);
        });
    }));

    beforeEach(angular.mock.module('cat.animations.delay'));
    beforeEach(angular.mock.module('ngAnimateMock'));

    beforeEach(angular.mock.inject(($compile, $rootScope, _$timeout_, _catAnimationLink_, _catBaseAnimation_, _catDelayS_) => {
        scope = $rootScope.$new();
        catAnimationLink =  _catAnimationLink_;
        catBaseAnimation =  _catBaseAnimation_;
        catDelayS = _catDelayS_;
        scope.visible = false;
        compile = () => {
            let parentElement = angular.element(template);
            parentElement.data('$catTimelineController', timelineController);
            $compile(parentElement)(scope);
            element = parentElement.children();
            scope.$apply();
        };

        $timeout = _$timeout_;
    }));

    afterEach(() => {
        sandbox.restore();
    });

    it('should set the status to READY if variable is binded', () => {
        compile();
        scope.status.should.equal('READY');
    });

    it('should register itself on the catTimeline parent controller', () => {
        sinon.spy(timelineController, 'register');
        compile();
        timelineController.register.should.have.been.calledOnce;
        timelineController.register.should.have.been.calledWith('animation-name', element.controller('catDelay'));
    });

    describe('#Linking Function', () => {
        it('Should call catAnimationLink function', () => {
            compile();
            catAnimationLink.should.have.been.calledOnce;
        });
    });

    describe('#Controller', () => {
        let controller;

        beforeEach(() => {
            compile();
            controller = element.controller('catDelay');
        });

        it('Should use catBaseAnimation', () => {
            catBaseAnimation.should.have.been.calledOnce;
        });

        it('Should pass scope catBaseAnimation', () => {
            var config;
            config = catBaseAnimation.args[0][0];
            config.$scope.should.equal(scope);
        });

        it('Should pass catBaseAnimation a config with defined onPlay and attrs', () => {
{'fraction_non_alphanumeric': 0.13823953823953825, 'fraction_numerical': 0.0017316017316017316, 'mean_word_length': 2.0613957597173145, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5311412', 'n_tokens_mistral': 1845, 'n_tokens_neox': 1761, 'n_words': 283}