Sha256: cfb1bdc00e3068598e17ea9e3aa62608dc043cdb24ac8896a54136a20a0aba79

Contents?: true

Size: 1.43 KB

Versions: 62

Compression:

Stored size: 1.43 KB

Contents

(function () {
    'use strict';

    describe('WORKAREA.backToTopButton', function () {
        describe('init', function () {
            beforeEach(function () {
                this.fixtures = fixture.load('back_to_top_button.html');
                WORKAREA.backToTopButton.init($(this.fixtures));
            });

            afterEach(function () {
                $('#back-to-top-button').remove();
            });

            it('injects a button', function () {
                expect(_.isEmpty($('#back-to-top-button'))).to.equal(false);
            });

            it('saves a waypoint instance to the element', function () {
                var $trigger = $('[data-back-to-top-button]'),
                    waypoint = $trigger.data('backToTopWaypoint');

                expect(waypoint).to.be.an('object');
                expect(waypoint.element).to.equal($trigger[0]);
                expect(waypoint.key).to.include('waypoint');
            });

            it('handles the visibility of the button', function () {
                var $trigger = $('[data-back-to-top-button]'),
                    waypoint = $trigger.data('backToTopWaypoint');

                waypoint.callback('down');
                expect(_.isEmpty($('.back-to-top-button--visible'))).to.equal(false);

                waypoint.callback('up');
                expect(_.isEmpty($('.back-to-top-button--visible'))).to.equal(true);
            });
        });
    });
}());

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.5.27 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.5.26 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.4.45 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.5.25 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.5.23 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.4.44 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.5.22 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.4.43 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.5.21 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.4.42 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.5.20 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.4.41 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.5.19 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.4.40 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.5.18 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.4.39 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.5.17 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.4.38 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.5.16 test/javascripts/back_to_top_button_spec.js
workarea-storefront-3.4.37 test/javascripts/back_to_top_button_spec.js