<commit_before>requirejs([
    '../vendor/chai/chai',
    'jquery',
    '../js/modules/toggler',
], function (
    chai,
    $,
    Toggler
) {

    'use strict';

    mocha.setup('bdd');
    var expect = chai.expect;

    describe('Toggler', function () {
        describe('constructor', function () {
            it('should initialize', function () {
                var m = new Toggler({
                    name: 'test',
                });
                expect(m).to.not.equal(undefined);
            });

            it('should have toggler block', function () {
                var m = new Toggler({
                    name: 'test',
                });
                expect(m.bToggler[0]).to.not.equal(undefined);
            });

            it('should have panel block', function () {
                var m = new Toggler({
                    name: 'test',
                });
                expect(m.bPanel[0]).to.not.equal(undefined);
            });
        });

        describe('functional', function () {
            it('`_open` should open panel and change toggler text to \'Hide\'', function () {
                var m = new Toggler({
                    name: 'test',
                });
                m._open();
                expect(m.bToggler.find('.b-toggler__text._name_opened').is(':visible')).to.equal(true);
                expect(m.bToggler.find('.b-toggler__text._name_closed').is(':visible')).to.equal(false);
                expect(m.bPanel.is(':visible')).to.equal(true);
            });

            it('`_close` should close panel and change toggler text to \'Show\'', function () {
                var m = new Toggler({
                    name: 'test',
                });
                m._close();
                expect(m.bToggler.find('.b-toggler__text._name_opened').is(':visible')).to.equal(false);
                expect(m.bToggler.find('.b-toggler__text._name_closed').is(':visible')).to.equal(true);
                expect(m.bPanel.is(':visible')).to.equal(false);
            });

            it('`toggle` should toggle panel and toggler text', function () {
                var m = new Toggler({
                    name: 'test',
                });
                m.toggle();
                expect(m.bToggler.find('.b-toggler__text._name_opened').is(':visible')).to.equal(true);
                expect(m.bToggler.find('.b-toggler__text._name_closed').is(':visible')).to.equal(false);
                expect(m.bPanel.is(':visible')).to.equal(true);
                m.toggle();
                expect(m.bToggler.find('.b-toggler__text._name_opened').is(':visible')).to.equal(false);
                expect(m.bToggler.find('.b-toggler__text._name_closed').is(':visible')).to.equal(true);
                expect(m.bPanel.is(':visible')).to.equal(false);
            });
        });
    });

    if (window.mochaPhantomJS) {
        mochaPhantomJS.run();
    } else {
        mocha.run();
    }<commit_msg>Tests structure<commit_after>requirejs([
    '../vendor/chai/chai',
    'jquery',
    '../js/modules/toggler',
], function (
    chai,
    $,
    Toggler
) {

    'use strict';

    mocha.setup('bdd');
    var expect = chai.expect;

    describe('Toggler', function () {
        describe('constructor', function () {
            it('should initialize', function () {
                var m = new Toggler({
                    name: 'test',
                });
                expect(m).to.not.equal(undefined);
            });

            it('should have toggler block', function () {
                var m = new Toggler({
                    name: 'test',
                });
                expect(m.bToggler[0]).to.not.equal(undefined);
            });

            it('should have panel block', function () {
                var m = new Toggler({
                    name: 'test',
                });
                expect(m.bPanel[0]).to.not.equal(undefined);
            });
        });

        describe('#_open', function () {
            it('should open panel and change toggler text to \'Hide\'', function () {
                var m = new Toggler({
                    name: 'test',
                });
                m._open();
                expect(m.bToggler.find('.b-toggler__text._name_opened').is(':visible')).to.equal(true);
                expect(m.bToggler.find('.b-toggler__text._name_closed').is(':visible')).to.equal(false);
                expect(m.bPanel.is(':visible')).to.equal(true);
            });
        });

        describe('#_close', function () {
            it('should close panel and change toggler text to \'Show\'', function () {
                var m = new Toggler({
                    name: 'test',
                });
                m._close();
                expect(m.bToggler.find('.b-toggler__text._name_opened').is(':visible')).to.equal(false);
                expect(m.bToggler.find('.b-toggler__text._name_closed').is(':visible')).to.equal(true);
                expect(m.bPanel.is(':visible')).to.equal(false);
            });
        });

        describe('#toggle', function () {
            it('should toggle panel and toggler text', function () {
                var m = new Toggler({
                    name: 'test',
                });
                m.toggle();
                expect(m.bToggler.find('.b-toggler__text._name_opened').is(':visible')).to.equal(true);
                expect(m.bToggler.find('.b-toggler__text._name_closed').is(':visible')).to.equal(false);
                expect(m.bPanel.is(':visible')).to.equal(true);
                m.toggle();
                expect(m.bToggler.find('.b-toggler__text._name_opened').is(':visible')).to.equal(false);
                expect(m.bToggler.find('.b-toggler__text._name_closed').is(':visible')).to.equal(true);
                expect(m.bPanel.is(':visible')).to.equal(false);
            });
        });
    });

    if (window.mochaPhantomJS) {
        mochaPhantomJS.run();
    } else {
        mocha.run();
    }
{'fraction_non_alphanumeric': 0.16983333333333334, 'fraction_numerical': 0.0006666666666666666, 'mean_word_length': 1.548195329087049, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4863932', 'n_tokens_mistral': 1818, 'n_tokens_neox': 1741, 'n_words': 246}