unit test cases for lock/unlock

This commit is contained in:
Rajnikant Lodhi 2022-09-07 14:56:34 +05:30
parent 0c0d27fd6e
commit 872ebdae09
2 changed files with 4 additions and 4 deletions

View File

@ -25,7 +25,7 @@ import { NodesDataSource } from '../../../cartography/datasources/nodes-datasour
import { DrawingsEventSource } from '../../../cartography/events/drawings-event-source'; import { DrawingsEventSource } from '../../../cartography/events/drawings-event-source';
import { DrawingsDataSource } from '../../../cartography/datasources/drawings-datasource'; import { DrawingsDataSource } from '../../../cartography/datasources/drawings-datasource';
fdescribe('ProjectMapMenuComponent', () => { describe('ProjectMapMenuComponent', () => {
let component: ProjectMapMenuComponent; let component: ProjectMapMenuComponent;
let fixture: ComponentFixture<ProjectMapMenuComponent>; let fixture: ComponentFixture<ProjectMapMenuComponent>;
let drawingService = new MockedDrawingService(); let drawingService = new MockedDrawingService();
@ -94,9 +94,9 @@ fdescribe('ProjectMapMenuComponent', () => {
spyOn(mapSettingService, 'changeMapLockValue'); spyOn(mapSettingService, 'changeMapLockValue');
component.changeLockValue(); component.changeLockValue();
expect(mapSettingService.changeMapLockValue).toHaveBeenCalled(); expect(mapSettingService.changeMapLockValue).toHaveBeenCalledWith(true);;
component.changeLockValue(); component.changeLockValue();
expect(mapSettingService.changeMapLockValue).toHaveBeenCalled(); expect(mapSettingService.changeMapLockValue).toHaveBeenCalledWith(false);;
}); });
}); });

View File

@ -210,6 +210,7 @@ export class ProjectMapMenuComponent implements OnInit, OnDestroy {
public changeLockValue() { public changeLockValue() {
this.isLocked = !this.isLocked; this.isLocked = !this.isLocked;
this.mapSettingsService.changeMapLockValue(this.isLocked);
const dialogRef = this.dialog.open(ProjectMapLockConfirmationDialogComponent, { const dialogRef = this.dialog.open(ProjectMapLockConfirmationDialogComponent, {
width: '500px', width: '500px',
maxHeight: '200px', maxHeight: '200px',
@ -225,7 +226,6 @@ export class ProjectMapMenuComponent implements OnInit, OnDestroy {
} else { } else {
this.unlockAllNode(); this.unlockAllNode();
} }
this.mapSettingsService.changeMapLockValue(this.isLocked);
} else { } else {
} }
}); });