mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-29 15:43:58 +00:00
Fix tests
This commit is contained in:
parent
3e4bf71c9c
commit
c1b9d29b43
@ -36,6 +36,9 @@ export class SelectionControlComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
const selectedLabels = this.graphDataManager.getNodes().filter((node) => {
|
||||
if (node.label === undefined) {
|
||||
return false;
|
||||
}
|
||||
const labelX = node.x + node.label.x;
|
||||
const labelY = node.y + node.label.y;
|
||||
return this.inRectangleHelper.inRectangle(rectangle, labelX, labelY);
|
||||
|
@ -8,6 +8,7 @@ import { MapNode } from "../models/map/map-node";
|
||||
import { MapLink } from "../models/map/map-link";
|
||||
import { MapLinkNode } from "../models/map/map-link-node";
|
||||
import { MapLabel } from "../models/map/map-label";
|
||||
import { FontFixer } from "../helpers/font-fixer";
|
||||
|
||||
|
||||
describe('InterfaceLabelsWidget', () => {
|
||||
@ -67,7 +68,7 @@ describe('InterfaceLabelsWidget', () => {
|
||||
.exit()
|
||||
.remove();
|
||||
|
||||
widget = new InterfaceLabelWidget(new CssFixer());
|
||||
widget = new InterfaceLabelWidget(new CssFixer(), new FontFixer());
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -95,12 +95,6 @@ export class LabelWidget implements Widget {
|
||||
// // center
|
||||
// bbox = this.getBBox();
|
||||
// return - n.height / 2. - bbox.height ;
|
||||
// selected.filter((item) => item instanceof MapLabel).forEach((label: MapLabel) => {
|
||||
// label.x += evt.dx;
|
||||
// label.y += evt.dy;
|
||||
// console.log("test");
|
||||
// // this.drawingsWidget.redrawDrawing(svg, label);
|
||||
// });
|
||||
// }
|
||||
return l.y + bbox.height - LabelWidget.NODE_LABEL_MARGIN;
|
||||
})
|
||||
|
@ -10,6 +10,7 @@ import { NodeService } from './node.service';
|
||||
import { Appliance } from '../models/appliance';
|
||||
import { Project } from '../models/project';
|
||||
import { AppTestingModule } from "../testing/app-testing/app-testing.module";
|
||||
import { Label } from '../cartography/models/label';
|
||||
|
||||
describe('NodeService', () => {
|
||||
let httpClient: HttpClient;
|
||||
@ -102,6 +103,35 @@ describe('NodeService', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should update label of node', inject([NodeService], (service: NodeService) => {
|
||||
const node = new Node();
|
||||
node.project_id = "myproject";
|
||||
node.node_id = "id";
|
||||
|
||||
const label = new Label();
|
||||
label.rotation = 10;
|
||||
label.style = "my style";
|
||||
label.text = "my text";
|
||||
label.x = 10;
|
||||
label.y = 20;
|
||||
|
||||
service.updateLabel(server, node, label).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne(
|
||||
'http://127.0.0.1:3080/v2/projects/myproject/nodes/id');
|
||||
expect(req.request.method).toEqual("PUT");
|
||||
expect(req.request.body).toEqual({
|
||||
'label': {
|
||||
'rotation': 10,
|
||||
'style': 'my style',
|
||||
'text': 'my text',
|
||||
'x': 10,
|
||||
'y': 20,
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
it('should update node', inject([NodeService], (service: NodeService) => {
|
||||
const node = new Node();
|
||||
node.project_id = "myproject";
|
||||
|
45
yarn.lock
45
yarn.lock
@ -957,11 +957,6 @@ ansi-html@0.0.7:
|
||||
resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e"
|
||||
integrity sha1-gTWEAhliqenm/QOflA0S9WynhZ4=
|
||||
|
||||
ansi-regex@*:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.0.0.tgz#70de791edf021404c3fd615aa89118ae0432e5a9"
|
||||
integrity sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==
|
||||
|
||||
ansi-regex@^2.0.0:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
|
||||
@ -2864,7 +2859,7 @@ debug@^3.0.0, debug@^3.1.0:
|
||||
dependencies:
|
||||
ms "^2.1.1"
|
||||
|
||||
debuglog@*, debuglog@^1.0.1:
|
||||
debuglog@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
|
||||
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
|
||||
@ -4631,7 +4626,7 @@ import-local@^2.0.0:
|
||||
pkg-dir "^3.0.0"
|
||||
resolve-cwd "^2.0.0"
|
||||
|
||||
imurmurhash@*, imurmurhash@^0.1.4:
|
||||
imurmurhash@^0.1.4:
|
||||
version "0.1.4"
|
||||
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
|
||||
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
|
||||
@ -5648,11 +5643,6 @@ lockfile@~1.0.2:
|
||||
dependencies:
|
||||
signal-exit "^3.0.2"
|
||||
|
||||
lodash._baseindexof@*:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
|
||||
integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=
|
||||
|
||||
lodash._baseuniq@~4.6.0:
|
||||
version "4.6.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
|
||||
@ -5661,33 +5651,11 @@ lodash._baseuniq@~4.6.0:
|
||||
lodash._createset "~4.0.0"
|
||||
lodash._root "~3.0.0"
|
||||
|
||||
lodash._bindcallback@*:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
|
||||
integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=
|
||||
|
||||
lodash._cacheindexof@*:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
|
||||
integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=
|
||||
|
||||
lodash._createcache@*:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
|
||||
integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
|
||||
dependencies:
|
||||
lodash._getnative "^3.0.0"
|
||||
|
||||
lodash._createset@~4.0.0:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
|
||||
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=
|
||||
|
||||
lodash._getnative@*, lodash._getnative@^3.0.0:
|
||||
version "3.9.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
|
||||
integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=
|
||||
|
||||
lodash._root@~3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692"
|
||||
@ -5713,11 +5681,6 @@ lodash.mergewith@^4.6.0:
|
||||
resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927"
|
||||
integrity sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==
|
||||
|
||||
lodash.restparam@*:
|
||||
version "3.6.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
|
||||
integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=
|
||||
|
||||
lodash.tail@^4.1.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/lodash.tail/-/lodash.tail-4.1.1.tgz#d2333a36d9e7717c8ad2f7cacafec7c32b444664"
|
||||
@ -7722,7 +7685,7 @@ readable-stream@~2.1.5:
|
||||
string_decoder "~0.10.x"
|
||||
util-deprecate "~1.0.1"
|
||||
|
||||
readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0:
|
||||
readdir-scoped-modules@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747"
|
||||
integrity sha1-n6+jfShr5dksuuve4DDcm19AZ0c=
|
||||
@ -9457,7 +9420,7 @@ uuid@^3.0.1, uuid@^3.1.0, uuid@^3.3.2:
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
|
||||
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==
|
||||
|
||||
validate-npm-package-license@*, validate-npm-package-license@^3.0.1:
|
||||
validate-npm-package-license@^3.0.1:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a"
|
||||
integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==
|
||||
|
Loading…
x
Reference in New Issue
Block a user