bansho/app/components/topbar/topbar_test.js
2015-04-24 11:27:00 -04:00

44 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'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('<a>{{ notifications }}</a>');
}));
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('<bansho-topbar></bansho-topbar>')($rootScope);
$httpBackend.flush();
$rootScope.notifications = 44;
$rootScope.$digest();
expect(element.text()).toBe('44');
});
});
});