diff --git a/frontend-js/src/main/js/map/data/Reaction.js b/frontend-js/src/main/js/map/data/Reaction.js index ade385e75a611f9f4abf06b3fcb2f67c8509fd09..2bf32c40817b50f13eb7571db202e0b6341df132 100644 --- a/frontend-js/src/main/js/map/data/Reaction.js +++ b/frontend-js/src/main/js/map/data/Reaction.js @@ -108,6 +108,7 @@ Reaction.prototype.update = function(javaObject) { this.setDescription(javaObject.notes); this.setOther(javaObject.other); this.setReferences(javaObject.references); + this.setType(javaObject.type); if (javaObject.reactants !== "") { this.setReactants(javaObject.reactants.split(",")); @@ -267,6 +268,14 @@ Reaction.prototype.getModifiers = function() { return this._modifiers; }; +Reaction.prototype.setType = function(type) { + this._type = type; +}; + +Reaction.prototype.getType = function() { + return this._type; +}; + Reaction.prototype.getOther = function(type) { if (this._other !== undefined) { return this._other[type]; @@ -293,4 +302,4 @@ Reaction.prototype.setHierarchyVisibilityLevel = function(hierarchyVisibilityLev this._hierarchyVisibilityLevel = hierarchyVisibilityLevel; }; -module.exports = Reaction; +module.exports = Reaction; \ No newline at end of file diff --git a/frontend-js/src/test/js/map/data/Reaction-test.js b/frontend-js/src/test/js/map/data/Reaction-test.js index 8b3887d1648d09e19f13b178ded5df80e440fc49..dd8a99701eb20a5686acafb956a57e1368a1c4f6 100644 --- a/frontend-js/src/test/js/map/data/Reaction-test.js +++ b/frontend-js/src/test/js/map/data/Reaction-test.js @@ -17,30 +17,13 @@ describe('Reaction', function() { }); it("contructor", function() { - var javaObject = { - lines : [ { - start : Object, - end : Object, - type : "START" - }, { - start : Object, - end : Object, - type : "END" - }, { - start : Object, - end : Object, - type : "MIDDLE" - } ], - modelId : 319, - idObject : "13178", - centerPoint : { - x : 10, - y : 12, - }, - }; - var reaction = new Reaction(javaObject); - assert.ok(reaction); - assert.ok(reaction.getId()); + return ServerConnector.readFile("testFiles/reaction.json").then(function(content) { + var javaObject = JSON.parse(content); + var reaction = new Reaction(javaObject); + assert.ok(reaction); + assert.ok(reaction.getId()); + assert.ok(reaction.getType()); + }); }); it("constructor from invalid", function() { var javaObject = { diff --git a/frontend-js/testFiles/reaction.json b/frontend-js/testFiles/reaction.json new file mode 100644 index 0000000000000000000000000000000000000000..d87ae1c97ee466e0c42ec906a5afbc404b3869a7 --- /dev/null +++ b/frontend-js/testFiles/reaction.json @@ -0,0 +1,44 @@ + { + "modelId" : 15781, + "reactants" : "329166", + "reactionId" : "re21", + "id" : 153508, + "type" : "State transition", + "lines" : [ { + "start" : { + "x" : 129.00000000000003, + "y" : 269.9853478599471 + }, + "end" : { + "x" : 217.3857151822324, + "y" : 271.4614610007049 + }, + "type" : "START" + }, { + "start" : { + "x" : 217.3857151822324, + "y" : 271.4614610007049 + }, + "end" : { + "x" : 217.98919008325365, + "y" : 297.73178548394236 + }, + "type" : "MIDDLE" + }, { + "start" : { + "x" : 218.17291548409574, + "y" : 305.7296755167626 + }, + "end" : { + "x" : 218.77639038511697, + "y" : 332.0 + }, + "type" : "END" + } ], + "modifiers" : "", + "centerPoint" : { + "x" : 218.0810527836747, + "y" : 301.7307305003525 + }, + "products" : "329171" +} \ No newline at end of file