X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=sdnr%2Fwireless-transport%2Fcode-Carbon-SR1%2Fapps%2Fdlux%2Fdlux-web%2Fsrc%2Fcommon%2Fnavigation%2Fnavigation.spec.js;fp=sdnr%2Fwireless-transport%2Fcode-Carbon-SR1%2Fapps%2Fdlux%2Fdlux-web%2Fsrc%2Fcommon%2Fnavigation%2Fnavigation.spec.js;h=0000000000000000000000000000000000000000;hb=1c1e7f98416875f3ee78af9103865c32f95a82a0;hp=db4e4b1816bafca68b29a641ad079ee8752a14ff;hpb=6a893bb0ae984d15076394d9225d4873ad953791;p=ccsdk%2Fapps.git diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/dlux/dlux-web/src/common/navigation/navigation.spec.js b/sdnr/wireless-transport/code-Carbon-SR1/apps/dlux/dlux-web/src/common/navigation/navigation.spec.js deleted file mode 100644 index db4e4b18..00000000 --- a/sdnr/wireless-transport/code-Carbon-SR1/apps/dlux/dlux-web/src/common/navigation/navigation.spec.js +++ /dev/null @@ -1,103 +0,0 @@ -define(['common/navigation/navigation.module', 'angular-ui-router',], function () { - describe('Navigation Module', function () { - var scope, NavHelperMock, EventMock, controller; - - beforeEach(angular.mock.module('ui.router')); - beforeEach(module('app.core', function ($provide) { - function NavHelperProvider() { - this.addToView = function (url) {}; - this.addControllerUrl = function (url) {}; - this.$get = function NavHelperFactory() { - return new NavHelperProvider(); - }; - } - $provide.provider('NavHelper', NavHelperProvider); - })); - - beforeEach(module('app.common.nav')); - - beforeEach(inject(function ($rootScope, $controller) { - scope = $rootScope.$new(); - controller = $controller; - - NavHelperMock = { - getMenu: function () { - return { - "id": "", - "title": "", - "active": "", - "submenu": "" - }; - } - }; - - EventMock = { - stopPropagation: function () { - return null; - }, - preventDefault: function () { - return null; - } - }; - - })); - - it('Should have receive all menu items', function () { - spyOn(NavHelperMock, 'getMenu').andCallThrough(); - controller('NavCtrl', { - $scope: scope, - NavHelper: NavHelperMock - }); - - expect(NavHelperMock.getMenu).toHaveBeenCalled(); - expect(scope.navList).toBeDefined(); - }); - - it('Should have create utility methods to show and hide submenu', function () { - controller('NavItemCtrl', { - $scope: scope, - NavHelper: NavHelperMock - }); - - expect(scope.display).toEqual('none'); - expect(scope.isOpen).toBeFalsy(); - - expect(scope.isValid).toBeDefined(); - expect(scope.updateTemplate).toBeDefined(); - }); - - it('Should look if a item exist or not', function () { - controller('NavItemCtrl', { - $scope: scope, - NavHelper: NavHelperMock - }); - var item = {}; - - expect(scope.isValid(item)).toBeTruthy(); - expect(scope.isValid(null)).toBeFalsy(); - }); - - it('Should toggle the status of the item scope', function () { - spyOn(EventMock, 'stopPropagation').andCallThrough(); - spyOn(EventMock, 'preventDefault').andCallThrough(); - controller('NavItemCtrl', { - $scope: scope, - NavHelper: NavHelperMock - }); - - var initOpen = scope.isOpen; - var initDisplay = scope.display; - - scope.updateTemplate(EventMock, {}); - expect(scope.isOpen).not.toEqual(initOpen); - expect(scope.display).not.toEqual(initDisplay); - - scope.updateTemplate(EventMock, {}); - expect(scope.isOpen).toEqual(initOpen); - expect(scope.display).toEqual(initDisplay); - - expect(EventMock.stopPropagation.calls.length).toEqual(2); - expect(EventMock.preventDefault.calls.length).toEqual(2); - }); - }); -});