Sha256: 85538755b90d52717501ff007248b52805a90a3523202ece6256604b22b2fb07

Contents?: true

Size: 1.75 KB

Versions: 70

Compression:

Stored size: 1.75 KB

Contents

describe('Directive: bstFlyout', function() {
    var scope,
        compile,
        testItems,
        element,
        elementScope;

    beforeEach(module('Bastion.components', 'components/views/bst-flyout.html'));

    beforeEach(inject(function(_$compile_, _$rootScope_) {
        compile = _$compile_;
        scope = _$rootScope_;
    }));

    beforeEach(function() {
        testItems = [
            {url: 'http://redhat.com', display: 'Red Hat'},
            {url: 'http://google.com', display: 'Google'},
        ];
        scope.items = testItems;

        element = angular.element('<ul bst-flyout="items"></ul>');
        compile(element)(scope);
        scope.$digest();

        elementScope = element.isolateScope();
        elementScope.setHover = function() {};
    });

    it("should display a .flyout <ul>", function() {
        expect(element.is('ul')).toBe(true);
        expect(element.hasClass('flyout')).toBe(true);
    });

    it("should display an <li> element for each item.", function() {
        expect(element.find('li').length).toBe(2);
        expect(element.find('.flyout-item').length).toBe(2);
    });

    describe("should respond to mouse events", function() {
        var target;

        beforeEach(function() {
            target = angular.element(element.find('li')[1]);
            spyOn(elementScope, 'setHover');
        });

        it("by setting the item to active on mouse in", function() {
            target.mouseenter();

            expect(elementScope.setHover).toHaveBeenCalledWith(testItems[1], true);
        });

        it("by setting the item to inactive on mouse out", function() {
            target.mouseleave();

            expect(elementScope.setHover).toHaveBeenCalledWith(testItems[1], false);
        });
    });
});

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
bastion-6.1.23 test/components/bst-flyout.directive.test.js
bastion-6.1.22 test/components/bst-flyout.directive.test.js
bastion-6.1.21 test/components/bst-flyout.directive.test.js
bastion-6.1.20 test/components/bst-flyout.directive.test.js
bastion-6.1.19 test/components/bst-flyout.directive.test.js
bastion-6.1.18 test/components/bst-flyout.directive.test.js
bastion-6.1.17 test/components/bst-flyout.directive.test.js
bastion-6.1.16 test/components/bst-flyout.directive.test.js
bastion-6.1.15 test/components/bst-flyout.directive.test.js
bastion-6.1.14 test/components/bst-flyout.directive.test.js
bastion-6.1.13 test/components/bst-flyout.directive.test.js
bastion-6.1.12 test/components/bst-flyout.directive.test.js
bastion-6.1.11 test/components/bst-flyout.directive.test.js
bastion-6.1.10 test/components/bst-flyout.directive.test.js
bastion-6.1.9 test/components/bst-flyout.directive.test.js
bastion-6.1.8 test/components/bst-flyout.directive.test.js
bastion-6.1.7 test/components/bst-flyout.directive.test.js
bastion-6.1.6 test/components/bst-flyout.directive.test.js
bastion-6.1.5 test/components/bst-flyout.directive.test.js
bastion-6.1.4 test/components/bst-flyout.directive.test.js