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.5.15 test/javascripts/tooltips_spec.js
workarea-admin-3.4.36 test/javascripts/tooltips_spec.js
workarea-admin-3.5.14 test/javascripts/tooltips_spec.js
workarea-admin-3.4.35 test/javascripts/tooltips_spec.js
workarea-admin-3.5.13 test/javascripts/tooltips_spec.js
workarea-admin-3.4.34 test/javascripts/tooltips_spec.js
workarea-admin-3.5.12 test/javascripts/tooltips_spec.js
workarea-admin-3.4.33 test/javascripts/tooltips_spec.js
workarea-admin-3.5.11 test/javascripts/tooltips_spec.js
workarea-admin-3.5.10 test/javascripts/tooltips_spec.js
workarea-admin-3.4.32 test/javascripts/tooltips_spec.js
workarea-admin-3.5.9 test/javascripts/tooltips_spec.js
workarea-admin-3.4.31 test/javascripts/tooltips_spec.js
workarea-admin-3.5.8 test/javascripts/tooltips_spec.js
workarea-admin-3.4.30 test/javascripts/tooltips_spec.js
workarea-admin-3.5.7 test/javascripts/tooltips_spec.js
workarea-admin-3.4.29 test/javascripts/tooltips_spec.js
workarea-admin-3.5.6 test/javascripts/tooltips_spec.js
workarea-admin-3.4.28 test/javascripts/tooltips_spec.js
workarea-admin-3.5.5 test/javascripts/tooltips_spec.js