# HG changeset patch # User Nicholas Jillings # Date 1464343320 -3600 # Node ID de547cf9a4e7549a02e682ddbf460f819d2c8233 # Parent d44b5e04acbc2c757d0f34bdc8c6c4382b2e6d04 WIP for #79 diff -r d44b5e04acbc -r de547cf9a4e7 test_create/test_core.js --- a/test_create/test_core.js Fri May 27 10:39:35 2016 +0100 +++ b/test_create/test_core.js Fri May 27 11:02:00 2016 +0100 @@ -1943,6 +1943,21 @@ this.deleteNode.root.textContent = "Delete Entry"; this.deleteNode.root.addEventListener("click",this.deleteNode,false); this.buttonDOM.appendChild(this.deleteNode.root); + + this.getSurveyPosition = function() { + return this.parent.specification.options.findIndex(function(element){ + if (element == this) {return true;} + else {return false;} + },this.specification); + } + + this.swapOrder = function(other) { + // Enables two nodes to swap their respective positions + var other_pos = other.getSurveyPosition(); + var my_pos = this.getSurveyPosition(); + this.parent.specification.options[other_pos] = this.specification; + this.parent.specification.options[my_pos] = other.specification; + } } this.addNode = { root: document.createElement("button"),