Sha256: 20776cd0ae822a4cfd0c1c11bd6b578ef1c30756275b5144235d90031f78b196

Contents?: true

Size: 1.92 KB

Versions: 62

Compression:

Stored size: 1.92 KB

Contents

(function () {
    'use strict';

    describe('WORKAREA.tooltips', function () {
        describe('init', function () {
            it('inits tooltipster on the link', function () {
                this.fixtures = fixture.load('tooltip.html', true);

                sinon.spy($.prototype, 'tooltipster');

                WORKAREA.tooltips.init($(this.fixtures));

                expect($.fn.tooltipster.calledOnce).to.equal(true);
                expect(_.includes($('#help-link').attr('class'), 'tooltipstered')).to.equal(true);
                expect(_.includes($('#tooltip').attr('class'), 'tooltip-content')).to.equal(true);

                $.fn.tooltipster.restore();
            });
        });

        describe('positionTooltip', function () {
            var instance = {}, helper = {}, position = {};

            beforeEach(function () {
                helper.geo = {};
                helper.geo.origin = {};
                helper.geo.window = {};
                helper.geo.window.scroll = { top: null, left: null };
                position.coord = { top: null, left: null };
            });

            it('displays the tooltip along the bottom edge of origin', function () {
                var result;

                position.size = { width: 300 }; // tooltip width
                helper.geo.window.size = { width: 1000 }; // window width
                helper.geo.origin.offset = { left: 100, bottom: 200 }; // origin offset

                result = WORKAREA.tooltips.positionTooltip(instance, helper, position);

                expect(result.coord.top).to.equal(200);

                helper.geo.origin.offset.left = 900; // origin too close to right edge

                result = WORKAREA.tooltips.positionTooltip(instance, helper, position);

                expect(result.coord.top).to.equal(200);
                expect(result.coord.left).to.equal(700); // window width - tooltip width
            });
        });
    });
}());

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.4.27 test/javascripts/tooltips_spec.js
workarea-admin-3.5.4 test/javascripts/tooltips_spec.js
workarea-admin-3.4.26 test/javascripts/tooltips_spec.js
workarea-admin-3.5.3 test/javascripts/tooltips_spec.js
workarea-admin-3.4.25 test/javascripts/tooltips_spec.js
workarea-admin-3.5.2 test/javascripts/tooltips_spec.js
workarea-admin-3.4.24 test/javascripts/tooltips_spec.js
workarea-admin-3.5.1 test/javascripts/tooltips_spec.js
workarea-admin-3.4.23 test/javascripts/tooltips_spec.js
workarea-admin-3.4.22 test/javascripts/tooltips_spec.js
workarea-admin-3.5.0 test/javascripts/tooltips_spec.js
workarea-admin-3.4.21 test/javascripts/tooltips_spec.js
workarea-admin-3.5.0.beta.1 test/javascripts/tooltips_spec.js
workarea-admin-3.4.20 test/javascripts/tooltips_spec.js
workarea-admin-3.4.19 test/javascripts/tooltips_spec.js
workarea-admin-3.4.18 test/javascripts/tooltips_spec.js
workarea-admin-3.4.17 test/javascripts/tooltips_spec.js
workarea-admin-3.4.16 test/javascripts/tooltips_spec.js
workarea-admin-3.4.15 test/javascripts/tooltips_spec.js
workarea-admin-3.4.14 test/javascripts/tooltips_spec.js