thingsboard/ui/node_modules/ngFlowchart/app/flowchart/edgedrawing-service_test.js

31 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-05-19 11:43:42 +03:00
'use strict';
describe('The edgedrawing service', function() {
beforeEach(function() {
module('flowchart');
});
beforeEach(inject(function(Edgedrawingservice, flowchartConstants) {
this.Edgedrawingservice = Edgedrawingservice;
this.flowchartConstants = flowchartConstants;
this.startPoint = {x: 10, y: 10};
this.endPoint = {x: 50, y: 50};
this.LINE_MATCHER = 'M 10, 10 L 50, 50';
this.CURVE_MATCHER = /^M 10, 10 C (.*) 50, 50$/; // Move to start point, curve and end at endpoint.
}));
it('should implement linestyle', function() {
var line = this.Edgedrawingservice.getEdgeDAttribute(angular.copy(this.startPoint), angular.copy(this.endPoint), this.flowchartConstants.lineStyle);
expect(line).toEqual(this.LINE_MATCHER);
});
it('should implement curvedstyle', function() {
var curve = this.Edgedrawingservice.getEdgeDAttribute(angular.copy(this.startPoint), angular.copy(this.endPoint), this.flowchartConstants.curvedStyle);
expect(curve).toMatch(this.CURVE_MATCHER);
});
});