Sha256: 3a520a4f0065bc45b6604326a8b3f8fcee5aef65aa1bf1f070238ab4a63df3a6

Contents?: true

Size: 1.29 KB

Versions: 70

Compression:

Stored size: 1.29 KB

Contents

describe('Factory: PageTitle', function () {
    var $window, $interpolate, PageTitle;

    beforeEach(module('Bastion.components'));

    beforeEach(inject(function (_$window_, _$interpolate_, _PageTitle_) {
        $window = _$window_;
        $interpolate = _$interpolate_;
        PageTitle = _PageTitle_;
    }));

    it("provides a way to set titles", function () {
        PageTitle.setTitle("my new title: {{ title }}", {title: 'blah'})
        expect(PageTitle.titles.length).toBe(1);
        expect($window.document.title).toBe("my new title: blah");
    });

    it("provides a way to reset to the first title", function () {
        PageTitle.setTitle("my new title: {{ title }}", {title: 'blah'})
        PageTitle.setTitle('title 1');
        PageTitle.setTitle('title 2');

        PageTitle.resetToFirst();
        expect(PageTitle.titles.length).toBe(1);
        expect($window.document.title).toBe("my new title: blah");
    });

    it("stores a stack of titles and provides a way to retrieve it", function () {
        expect(PageTitle.titles.length).toBe(0);

        PageTitle.setTitle('title 1');
        expect(PageTitle.titles.length).toBe(1);

        PageTitle.setTitle('title 2');
        expect(PageTitle.titles.length).toBe(2);
        expect(PageTitle.titles[1]).toBe('title 2');
    })
});

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
bastion-3.1.0 test/components/page-title.service.test.js
bastion-3.0.1 test/components/page-title.service.test.js
bastion-3.0.0 test/components/page-title.service.test.js
bastion-2.1.0 test/components/page-title.service.test.js
bastion-2.0.4 test/components/page-title.service.test.js
bastion-2.0.3 test/components/page-title.service.test.js
bastion-2.0.2 test/components/page-title.service.test.js
bastion-2.0.1 test/components/page-title.service.test.js
bastion-2.0.0 test/components/page-title.service.test.js
bastion-1.0.2 test/components/page-title.service.test.js