Sha256: 17df6150d4d88a5de05c3cc7b10f7f005c809b8369b901c4df6d1316d40c99c9
Contents?: true
Size: 1.34 KB
Versions: 70
Compression:
Stored size: 1.34 KB
Contents
describe('Directive: setTitle', function () { var $scope, $compile, PageTitle, resource, element; beforeEach(module('Bastion.components', 'Bastion.test-mocks')); beforeEach(module(function ($provide) { PageTitle = { setTitle: function () {} }; $provide.value('PageTitle', PageTitle); })); beforeEach(inject(function (_$compile_, _$rootScope_, MockResource) { $compile = _$compile_; $scope = _$rootScope_; resource = MockResource.$new().get({id: 1}); })); it("should wait on a promise if the model is provided", function () { spyOn(PageTitle, 'setTitle'); $scope.resource = resource; element = angular.element('<div page-title ng-model="resource">new awesome title</div>'); $compile(element)($scope); expect(PageTitle.setTitle).not.toHaveBeenCalled(); $scope.$digest(); expect(PageTitle.setTitle).toHaveBeenCalledWith('new awesome title', jasmine.any(Object)); }); it("should set the page title without waiting for a $promise if none exists", function () { spyOn(PageTitle, 'setTitle'); element = angular.element('<div page-title>new awesome title</div>'); $compile(element)($scope); expect(PageTitle.setTitle).toHaveBeenCalledWith('new awesome title', jasmine.any(Object)); }); });
Version data entries
70 entries across 70 versions & 1 rubygems