Mercurial > hg > webaudioevaluationtool
comparison test_create/test_core.js @ 1286:1e2a2a9e9295
Adapted test_create.html to work with new Specification.js file.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Thu, 31 Mar 2016 14:32:22 +0100 |
parents | 6798b5afa2c9 |
children | 760719986df3 |
comparison
equal
deleted
inserted
replaced
1285:ae57d9f618cb | 1286:1e2a2a9e9295 |
---|---|
291 { | 291 { |
292 var testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(this.select.value)[0]; | 292 var testXML = interfaceSpecs.getElementsByTagName("tests")[0].getAllElementsByName(this.select.value)[0]; |
293 specification.interface = testXML.getAttribute("interface"); | 293 specification.interface = testXML.getAttribute("interface"); |
294 if (specification.interfaces == null) | 294 if (specification.interfaces == null) |
295 { | 295 { |
296 specification.interfaces = new specification.interfaceNode(); | 296 specification.interfaces = new specification.interfaceNode(specification); |
297 } | 297 } |
298 if (specification.metrics == null) { | 298 if (specification.metrics == null) { |
299 specification.metrics = new specification.metricNode(); | 299 specification.metrics = new specification.metricNode(); |
300 } | 300 } |
301 popupStateNodes.state[2].generate(); | 301 popupStateNodes.state[2].generate(); |
1425 } | 1425 } |
1426 } | 1426 } |
1427 | 1427 |
1428 // Now both before and after surveys | 1428 // Now both before and after surveys |
1429 if (specification.preTest == undefined){ | 1429 if (specification.preTest == undefined){ |
1430 specification.preTest = new specification.surveyNode(); | 1430 specification.preTest = new specification.surveyNode(specification); |
1431 specification.preTest.location = "pre"; | 1431 specification.preTest.location = "pre"; |
1432 } | 1432 } |
1433 if (specification.postTest == undefined){ | 1433 if (specification.postTest == undefined){ |
1434 specification.postTest = new specification.surveyNode(); | 1434 specification.postTest = new specification.surveyNode(specification); |
1435 specification.postTest.location = "post"; | 1435 specification.postTest.location = "post"; |
1436 } | 1436 } |
1437 var surveyBefore = new this.surveyNode(this,specification.preTest,"Pre"); | 1437 var surveyBefore = new this.surveyNode(this,specification.preTest,"Pre"); |
1438 var surveyAfter = new this.surveyNode(this,specification.postTest,"Post"); | 1438 var surveyAfter = new this.surveyNode(this,specification.postTest,"Post"); |
1439 this.setupDOM.children.push(surveyBefore); | 1439 this.setupDOM.children.push(surveyBefore); |
1445 this.addPage = { | 1445 this.addPage = { |
1446 root: document.createElement("button"), | 1446 root: document.createElement("button"), |
1447 parent: this, | 1447 parent: this, |
1448 handleEvent: function() | 1448 handleEvent: function() |
1449 { | 1449 { |
1450 var pageObj = new specification.page(); | 1450 var pageObj = new specification.page(specification); |
1451 specification.pages.push(pageObj); | 1451 specification.pages.push(pageObj); |
1452 var newPage = new this.parent.pageNode(this.parent,pageObj); | 1452 var newPage = new this.parent.pageNode(this.parent,pageObj); |
1453 this.parent.injectDOM.appendChild(newPage.rootDOM); | 1453 this.parent.injectDOM.appendChild(newPage.rootDOM); |
1454 this.parent.pages.push(newPage); | 1454 this.parent.pages.push(newPage); |
1455 } | 1455 } |
1891 this.addNode = { | 1891 this.addNode = { |
1892 root: document.createElement("button"), | 1892 root: document.createElement("button"), |
1893 parent: this, | 1893 parent: this, |
1894 handleEvent: function() | 1894 handleEvent: function() |
1895 { | 1895 { |
1896 var newNode = new this.parent.specification.OptionNode(); | 1896 var newNode = new this.parent.specification.OptionNode(this.parent.specification); |
1897 this.parent.specification.options.push(newNode); | 1897 this.parent.specification.options.push(newNode); |
1898 popupObject.show(); | 1898 popupObject.show(); |
1899 popupStateNodes.state[5].generate(newNode,this.parent); | 1899 popupStateNodes.state[5].generate(newNode,this.parent); |
1900 popupObject.postNode(popupStateNodes.state[5]); | 1900 popupObject.postNode(popupStateNodes.state[5]); |
1901 } | 1901 } |
1962 this.childrenDOM.appendChild(cpn.rootDOM); | 1962 this.childrenDOM.appendChild(cpn.rootDOM); |
1963 this.children.push(cpn); | 1963 this.children.push(cpn); |
1964 | 1964 |
1965 // Now both before and after surveys | 1965 // Now both before and after surveys |
1966 if (this.specification.preTest == undefined){ | 1966 if (this.specification.preTest == undefined){ |
1967 this.specification.preTest = new specification.surveyNode(); | 1967 this.specification.preTest = new specification.surveyNode(specification); |
1968 this.specification.preTest.location = "pre"; | 1968 this.specification.preTest.location = "pre"; |
1969 } | 1969 } |
1970 if (this.specification.postTest == undefined){ | 1970 if (this.specification.postTest == undefined){ |
1971 this.specification.postTest = new specification.surveyNode(); | 1971 this.specification.postTest = new specification.surveyNode(specification); |
1972 this.specification.postTest.location = "post"; | 1972 this.specification.postTest.location = "post"; |
1973 } | 1973 } |
1974 var surveyBefore = new this.parent.surveyNode(this,this.specification.preTest,"Pre"); | 1974 var surveyBefore = new this.parent.surveyNode(this,this.specification.preTest,"Pre"); |
1975 var surveyAfter = new this.parent.surveyNode(this,this.specification.postTest,"Post"); | 1975 var surveyAfter = new this.parent.surveyNode(this,this.specification.postTest,"Post"); |
1976 this.children.push(surveyBefore); | 1976 this.children.push(surveyBefore); |
2104 | 2104 |
2105 } | 2105 } |
2106 | 2106 |
2107 // Build the components | 2107 // Build the components |
2108 if (this.specification.interfaces.length == 0) { | 2108 if (this.specification.interfaces.length == 0) { |
2109 this.specification.interfaces.push(new specification.interfaceNode()); | 2109 this.specification.interfaces.push(new specification.interfaceNode(specification)); |
2110 } | 2110 } |
2111 for (var interfaceObj of this.specification.interfaces) | 2111 for (var interfaceObj of this.specification.interfaces) |
2112 { | 2112 { |
2113 var newInterface = new this.parent.interfaceNode(this.parent,interfaceObj); | 2113 var newInterface = new this.parent.interfaceNode(this.parent,interfaceObj); |
2114 newInterface.build("Interface",""+this.specification.id+"-interface",this.childrenDOM); | 2114 newInterface.build("Interface",""+this.specification.id+"-interface",this.childrenDOM); |
2125 | 2125 |
2126 this.addInterface = { | 2126 this.addInterface = { |
2127 root: document.createElement("button"), | 2127 root: document.createElement("button"), |
2128 parent: this, | 2128 parent: this, |
2129 handleEvent: function() { | 2129 handleEvent: function() { |
2130 var InterfaceObj = new specification.interfaceNode(); | 2130 var InterfaceObj = new specification.interfaceNode(specification); |
2131 var newInterface = new this.parent.parent.interfaceNode(this.parent.parent,InterfaceObj); | 2131 var newInterface = new this.parent.parent.interfaceNode(this.parent.parent,InterfaceObj); |
2132 newInterface.build("Interface",""+this.parent.specification.id+"-interface",this.parent.childrenDOM); | 2132 newInterface.build("Interface",""+this.parent.specification.id+"-interface",this.parent.childrenDOM); |
2133 this.parent.children.push(newInterface); | 2133 this.parent.children.push(newInterface); |
2134 this.parent.specification.interfaces.push(InterfaceObj); | 2134 this.parent.specification.interfaces.push(InterfaceObj); |
2135 this.parent.interfaces.push(newInterface); | 2135 this.parent.interfaces.push(newInterface); |
2141 | 2141 |
2142 this.addAudioElement = { | 2142 this.addAudioElement = { |
2143 root: document.createElement("button"), | 2143 root: document.createElement("button"), |
2144 parent: this, | 2144 parent: this, |
2145 handleEvent: function() { | 2145 handleEvent: function() { |
2146 var audioElementObject = new this.parent.specification.audioElementNode(); | 2146 var audioElementObject = new this.parent.specification.audioElementNode(specification); |
2147 var audioElementDOM = new this.parent.audioElementNode(this.parent,audioElementObject); | 2147 var audioElementDOM = new this.parent.audioElementNode(this.parent,audioElementObject); |
2148 this.parent.specification.audioElements.push(audioElementObject); | 2148 this.parent.specification.audioElements.push(audioElementObject); |
2149 this.parent.children.push(audioElementDOM); | 2149 this.parent.children.push(audioElementDOM); |
2150 this.parent.childrenDOM.appendChild(audioElementDOM.rootDOM); | 2150 this.parent.childrenDOM.appendChild(audioElementDOM.rootDOM); |
2151 } | 2151 } |