mirror of
https://github.com/ansible/awx.git
synced 2026-01-22 23:18:03 -03:30
Add Side Nav directive unit tests
This commit is contained in:
parent
7486503a16
commit
5c5293783d
@ -13,3 +13,4 @@ import '../../lib/models';
|
||||
// Import tests
|
||||
import './panel-body.spec';
|
||||
import './layout.spec';
|
||||
import './side-nav.spec';
|
||||
|
||||
46
awx/ui/client/test/unit/side-nav.spec.js
Normal file
46
awx/ui/client/test/unit/side-nav.spec.js
Normal file
@ -0,0 +1,46 @@
|
||||
describe('Components | Side Nav', () => {
|
||||
let $compile;
|
||||
let $rootScope;
|
||||
let element;
|
||||
let scope;
|
||||
|
||||
beforeEach(() => {
|
||||
angular.mock.module('gettext');
|
||||
angular.mock.module('I18N');
|
||||
angular.mock.module('ui.router');
|
||||
angular.mock.module('at.lib.services')
|
||||
angular.mock.module('at.lib.components')
|
||||
});
|
||||
|
||||
beforeEach(angular.mock.inject((_$compile_, _$rootScope_) => {
|
||||
$compile = _$compile_;
|
||||
$rootScope = _$rootScope_;
|
||||
scope = $rootScope.$new();
|
||||
|
||||
element = angular.element("<at-layout><at-side-nav></at-side-nav><at-layout>");
|
||||
element = $compile(element)(scope);
|
||||
scope.$digest();
|
||||
}));
|
||||
|
||||
describe('Side Nav Controller', () => {
|
||||
let sideNav;
|
||||
let sideNavCtrl;
|
||||
|
||||
beforeEach(() => {
|
||||
sideNav = angular.element(element[0].querySelector('.at-Layout-side'));
|
||||
sideNavCtrl = sideNav.controller('atSideNav');
|
||||
});
|
||||
|
||||
it('isExpanded defaults to false', () => {
|
||||
expect(sideNavCtrl.isExpanded).toBe(false);
|
||||
});
|
||||
|
||||
it('toggleExpansion()', () => {
|
||||
sideNavCtrl.toggleExpansion();
|
||||
expect(sideNavCtrl.isExpanded).toBe(true);
|
||||
|
||||
sideNavCtrl.toggleExpansion();
|
||||
expect(sideNavCtrl.isExpanded).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user