'use strict'; describe('Topbar module', function () { var $compile, $rootScope, $controller, $httpBackend; beforeEach(module('bansho.topbar')); beforeEach(inject(function (_$compile_, _$rootScope_, _$controller_, _$httpBackend_) { $compile = _$compile_; $rootScope = _$rootScope_; $controller = _$controller_; $httpBackend = _$httpBackend_; $httpBackend.expectGET('components/topbar/topbar.html').respond('{{ notifications }}'); })); describe('TopBarCtrl', function () { it('should be defined', function () { var scope = $rootScope.$new(), topbar = $controller('TopBarCtrl', { $scope : scopeĀ }); expect(topbar).toBeDefined(); }); }); describe('Topbar directive', function () { it('should insert the number of warnings', function () { var element = $compile('')($rootScope); $httpBackend.flush(); $rootScope.notifications = 44; $rootScope.$digest(); expect(element.text()).toBe('44'); }); }); });