mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-21 22:07:48 +00:00
Unit tests fixed
This commit is contained in:
parent
8764a417d3
commit
a242c1c66f
@ -96,6 +96,7 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
||||
const selected = this.selectionManager.getSelected();
|
||||
// update nodes
|
||||
let mapNodes = selected.filter(item => item instanceof MapNode);
|
||||
const lockedNodes = mapNodes.filter((item: MapNode) => item.locked);
|
||||
const selectedNodes = mapNodes.filter((item: MapNode) => !item.locked);
|
||||
selectedNodes.forEach((node: MapNode) => {
|
||||
node.x += evt.dx;
|
||||
@ -127,7 +128,7 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
||||
|
||||
// update labels
|
||||
let mapLabels = selected.filter(item => item instanceof MapLabel);
|
||||
const selectedLabels = mapLabels.filter((item: MapLabel) => selectedNodes.filter((node) => node.id === item.nodeId).length > 0);
|
||||
const selectedLabels = mapLabels.filter((item: MapLabel) => lockedNodes.filter((node) => node.id === item.nodeId).length === 0);
|
||||
selectedLabels.forEach((label: MapLabel) => {
|
||||
const isParentNodeSelected = selectedNodes.filter(node => node.id === label.nodeId).length > 0;
|
||||
if (isParentNodeSelected) {
|
||||
@ -142,7 +143,7 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
||||
|
||||
// update interface labels
|
||||
let mapLinkNodes = selected.filter(item => item instanceof MapLinkNode);
|
||||
const selectedLinkNodes = mapLinkNodes.filter((item: MapLinkNode) => selectedNodes.filter((node) => node.id === item.nodeId).length > 0);
|
||||
const selectedLinkNodes = mapLinkNodes.filter((item: MapLinkNode) => lockedNodes.filter((node) => node.id === item.nodeId).length === 0);
|
||||
selectedLinkNodes.forEach((interfaceLabel: MapLinkNode) => {
|
||||
const isParentNodeSelected = selectedNodes.filter(node => node.id === interfaceLabel.nodeId).length > 0;
|
||||
if (isParentNodeSelected) {
|
||||
@ -176,6 +177,7 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
||||
const selected = this.selectionManager.getSelected();
|
||||
|
||||
let mapNodes = selected.filter(item => item instanceof MapNode);
|
||||
const lockedNodes = mapNodes.filter((item: MapNode) => item.locked);
|
||||
const selectedNodes = mapNodes.filter((item: MapNode) => !item.locked);
|
||||
selectedNodes.forEach((item: MapNode) => {
|
||||
this.nodesEventSource.dragged.emit(new DraggedDataEvent<MapNode>(item, evt.dx, evt.dy));
|
||||
@ -188,7 +190,7 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
let mapLabels = selected.filter(item => item instanceof MapLabel);
|
||||
const selectedLabels = mapLabels.filter((item: MapLabel) => selectedNodes.filter((node) => node.id === item.nodeId).length > 0);
|
||||
const selectedLabels = mapLabels.filter((item: MapLabel) => lockedNodes.filter((node) => node.id === item.nodeId).length === 0);
|
||||
selectedLabels.forEach((label: MapLabel) => {
|
||||
const isParentNodeSelected = selectedNodes.filter(node => node.id === label.nodeId).length > 0;
|
||||
if (isParentNodeSelected) {
|
||||
@ -199,7 +201,7 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
let mapLinkNodes = selected.filter(item => item instanceof MapLinkNode);
|
||||
const selectedLinkNodes = mapLinkNodes.filter((item: MapLinkNode) => selectedNodes.filter((node) => node.id === item.nodeId).length > 0);
|
||||
const selectedLinkNodes = mapLinkNodes.filter((item: MapLinkNode) => lockedNodes.filter((node) => node.id === item.nodeId).length === 0)
|
||||
selectedLinkNodes.forEach((label: MapLinkNode) => {
|
||||
const isParentNodeSelected = selectedNodes.filter(node => node.id === label.nodeId).length > 0;
|
||||
if (isParentNodeSelected) {
|
||||
|
@ -48,6 +48,7 @@ describe('DrawingDraggedComponent', () => {
|
||||
};
|
||||
const mapDrawing: MapDrawing = {
|
||||
id: 'sampleId',
|
||||
locked: false,
|
||||
projectId: 'sampleprojectId',
|
||||
rotation: 0,
|
||||
svg: 'sampleSvg',
|
||||
|
@ -51,6 +51,7 @@ describe('DrawingResizedComponent', () => {
|
||||
};
|
||||
const mapDrawing: MapDrawing = {
|
||||
id: 'sampleId',
|
||||
locked: false,
|
||||
projectId: 'sampleprojectId',
|
||||
rotation: 0,
|
||||
svg: 'sampleSvg',
|
||||
|
@ -72,6 +72,7 @@ describe('LinkCreatedComponent', () => {
|
||||
firstPortName: 'sampleFirstPortName',
|
||||
height: 0,
|
||||
label: {} as MapLabel,
|
||||
locked: false,
|
||||
name: 'sampleName',
|
||||
nodeDirectory: 'sampleNodeDirectory',
|
||||
nodeType: 'sampleNodeType',
|
||||
|
@ -52,6 +52,7 @@ describe('NodeDraggedComponent', () => {
|
||||
firstPortName: 'sampleFirstPortName',
|
||||
height: 0,
|
||||
label: {} as MapLabel,
|
||||
locked: false,
|
||||
name: 'sampleName',
|
||||
nodeDirectory: 'sampleNodeDirectory',
|
||||
nodeType: 'sampleNodeType',
|
||||
|
@ -1,4 +1,4 @@
|
||||
<button mat-menu-item (click)="lock()">
|
||||
<mat-icon>lock</mat-icon>
|
||||
<span>Lock</span>
|
||||
<span>{{command}}</span>
|
||||
</button>
|
||||
|
@ -111,6 +111,7 @@ describe('DrawingService', () => {
|
||||
drawing.z = 30;
|
||||
drawing.rotation = 0;
|
||||
drawing.svg = '<svg></svg>';
|
||||
drawing.locked = false;
|
||||
|
||||
service.update(server, drawing).subscribe();
|
||||
|
||||
@ -121,7 +122,8 @@ describe('DrawingService', () => {
|
||||
y: 20,
|
||||
z: 30,
|
||||
rotation: 0,
|
||||
svg: '<svg></svg>'
|
||||
svg: '<svg></svg>',
|
||||
locked: false
|
||||
});
|
||||
}));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user