diff options
Diffstat (limited to 'portal-FE-common/src/app/pages/functional-menu')
3 files changed, 49 insertions, 37 deletions
diff --git a/portal-FE-common/src/app/pages/functional-menu/functional-menu-dialog/functional-menu-dialog.component.spec.ts b/portal-FE-common/src/app/pages/functional-menu/functional-menu-dialog/functional-menu-dialog.component.spec.ts index de79b9d8..439a2eeb 100644 --- a/portal-FE-common/src/app/pages/functional-menu/functional-menu-dialog/functional-menu-dialog.component.spec.ts +++ b/portal-FE-common/src/app/pages/functional-menu/functional-menu-dialog/functional-menu-dialog.component.spec.ts @@ -39,14 +39,22 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FunctionalMenuDialogComponent } from './functional-menu-dialog.component'; +import { FormsModule } from '@angular/forms'; +import { NgMaterialModule } from 'src/app/ng-material-module'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; describe('FunctionalMenuDialogComponent', () => { let component: FunctionalMenuDialogComponent; let fixture: ComponentFixture<FunctionalMenuDialogComponent>; + const nodedata: any = {"parentMenuId":"parentMenuTestId","children":{},"name":"TestName","parent":{"name":"TestParentName"}}; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FunctionalMenuDialogComponent ] + declarations: [ FunctionalMenuDialogComponent ], + imports:[FormsModule,NgMaterialModule,HttpClientTestingModule,BrowserAnimationsModule], + providers:[NgbActiveModal] }) .compileComponents(); })); @@ -54,6 +62,7 @@ describe('FunctionalMenuDialogComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(FunctionalMenuDialogComponent); component = fixture.componentInstance; + component.nodedata = nodedata; fixture.detectChanges(); }); diff --git a/portal-FE-common/src/app/pages/functional-menu/functional-menu.component.spec.ts b/portal-FE-common/src/app/pages/functional-menu/functional-menu.component.spec.ts index c5c562ed..ef05c229 100644 --- a/portal-FE-common/src/app/pages/functional-menu/functional-menu.component.spec.ts +++ b/portal-FE-common/src/app/pages/functional-menu/functional-menu.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FunctionalMenuComponent } from './functional-menu.component'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; describe('FunctionalMenuComponent', () => { let component: FunctionalMenuComponent; @@ -8,7 +9,8 @@ describe('FunctionalMenuComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FunctionalMenuComponent ] + declarations: [ FunctionalMenuComponent ], + imports:[HttpClientTestingModule] }) .compileComponents(); })); diff --git a/portal-FE-common/src/app/pages/functional-menu/functional-menu.component.ts b/portal-FE-common/src/app/pages/functional-menu/functional-menu.component.ts index 655b4cb4..d3b5a164 100644 --- a/portal-FE-common/src/app/pages/functional-menu/functional-menu.component.ts +++ b/portal-FE-common/src/app/pages/functional-menu/functional-menu.component.ts @@ -152,41 +152,42 @@ export class FunctionalMenuComponent implements OnInit { */ buildTree(treedataarray,ngbModal: NgbModal , _self){ //console.log("treedataarray>>>>",treedataarray); - $(function() { - $('#jqTree').tree('loadData', treedataarray); - $('#jqTree').tree({ - data: treedataarray, - autoOpen: false, - dragAndDrop: true, - onCreateLi: function(node, $li) { - ////console.log("node >>",node); - } - }).on( - 'tree.contextmenu', - function(event:any) { - // The clicked node is 'event.node' - var node = event.node; - openMenuDetailsModal(node, "view"); - } - ); + // $(function() { + // $('#jqTree').tree('loadData', treedataarray); + // $('#jqTree').tree({ + // data: treedataarray, + // autoOpen: false, + // dragAndDrop: true, + // onCreateLi: function(node, $li) { + // ////console.log("node >>",node); + // } + // }).on( + // 'tree.contextmenu', + // function(event:any) { + // // The clicked node is 'event.node' + // var node = event.node; + // openMenuDetailsModal(node, "view"); + // } + // ); - var openMenuDetailsModal = function(node: any, actionName: string ){ - const modalRef = ngbModal.open(FunctionalMenuDialogComponent, { size: 'lg' }); - modalRef.componentInstance.title = 'Functional Menu ',actionName; - if(node != 'undefined' && node){ - modalRef.componentInstance.nodedata = node; - modalRef.componentInstance.operationName = actionName; - }else{ - modalRef.componentInstance.nodedata = {}; - } - modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => { - //console.log("receivedEntry>>>>",receivedEntry); - ngbModal.dismissAll(); - if(receivedEntry.httpStatusCode===200){ - _self.getFunctionalMenu(); - } - }); - } - }); + // var openMenuDetailsModal = function(node: any, actionName: string ){ + // const modalRef = ngbModal.open(FunctionalMenuDialogComponent, { size: 'lg' }); + // modalRef.componentInstance.title = 'Functional Menu ',actionName; + // if(node != 'undefined' && node){ + // modalRef.componentInstance.nodedata = node; + // modalRef.componentInstance.operationName = actionName; + // }else{ + // modalRef.componentInstance.nodedata = {}; + // } + // modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => { + // //console.log("receivedEntry>>>>",receivedEntry); + // ngbModal.dismissAll(); + // if(receivedEntry.httpStatusCode===200){ + // _self.getFunctionalMenu(); + // } + // }); + // } + // }); + // } } } |