changeset 620:e0934138c676 Dev_main

Fixed test creator <surveyentry> options. Updated interface-specs for ABX.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Wed, 16 Mar 2016 15:17:04 +0000
parents c99d334d8534
children 85f2fc7a17ca
files core.js test_create/interface-specs.xml test_create/test_core.js test_create/test_create.html
diffstat 4 files changed, 60 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/core.js	Wed Mar 16 13:31:42 2016 +0000
+++ b/core.js	Wed Mar 16 15:17:04 2016 +0000
@@ -2028,19 +2028,13 @@
 				var statement = doc.createElement('statement');
 				statement.textContent = this.statement;
 				node.appendChild(statement);
-                if (this.type != "statement") {
-                    node.id = this.id;
-                    if (this.name != undefined) { node.setAttribute("name",this.name);}
-                    if (this.mandatory != undefined) { node.setAttribute("mandatory",this.mandatory);}
-                    switch(this.type)
-                    {
-                    case "question":
-                        if (this.boxsize != undefined) {node.setAttribute("boxsize",this.boxsize);}
-                        break;
-                    case "number":
-                        if (this.min != undefined) {node.setAttribute("min", this.min);}
-                        if (this.max != undefined) {node.setAttribute("max", this.max);}
-                        break;
+                node.id = this.id;
+                if (this.name != undefined) { node.setAttribute("name",this.name);}
+                if (this.mandatory != undefined) { node.setAttribute("mandatory",this.mandatory);}
+                node.id = this.id;
+                if (this.name != undefined) {node.setAttribute("name",this.name);}
+                switch(this.type)
+                {
                     case "checkbox":
                     case "radio":
                         for (var i=0; i<this.options.length; i++)
@@ -2051,8 +2045,14 @@
                             optionNode.textContent = option.text;
                             node.appendChild(optionNode);
                         }
+                    case "number":
+                        if (this.min != undefined) {node.setAttribute("min", this.min);}
+                        if (this.max != undefined) {node.setAttribute("max", this.max);}
+                    case "question":
+                        if (this.boxsize != undefined) {node.setAttribute("boxsize",this.boxsize);}
+                        if (this.mandatory != undefined) {node.setAttribute("mandatory",this.mandatory);}
+                    default:
                         break;
-                    }
                 }
 				return node;
 			};
--- a/test_create/interface-specs.xml	Wed Mar 16 13:31:42 2016 +0000
+++ b/test_create/interface-specs.xml	Wed Mar 16 15:17:04 2016 +0000
@@ -175,6 +175,36 @@
                 <outsidereference min="0" max="1"/>
             </elements>
         </interface>
+        <interface name="ABX">
+            <metrics>
+                <entry name="testTimer" support="optional" default="on"/>
+                <entry name="elementTimer" support="optional" default="on"/>
+                <entry name="elementInitialPosition" support="none"/>
+                <entry name="elementTracker" support="optional" default="on"/>
+                <entry name="elementFlagListenedTo" support="optional" default="on"/>
+                <entry name="elementFlagMoved" support="none"/>
+                <entry name="elementListenTracker" support="optional" default="on"/>
+            </metrics>
+            <checks>
+                <entry name="fragmentMoved" support="none"/>
+                <entry name="fragmentPlayed" support="optional" default="off"/>
+                <entry name="fragmentFullPlayback" support="optional" default="off"/>
+                <entry name="fragmentComments" support="optional" default="off"/>
+                <entry name="scalerange" support="none"/>
+            </checks>
+            <show>
+                <entry name="volume" support="optional" default="off"/>
+                <entry name="page-count" support="optional" default="off"/>
+                <entry name="playhead" support="optional" default="off"/>
+                <entry name="comments" support="optional" default="off"/>
+            </show>
+            <elements>
+                <number min="2" max="2"/>
+                <anchor min="0" max="0"/>
+                <reference min="0" max="0"/>
+                <outsidereference min="0" max="0"/>
+            </elements>
+        </interface>
     </interfaces>
     <scaledefinitions>
         <scale name="Likert">
@@ -413,25 +443,7 @@
                 <number min="2" max="2"/>
                 <outsidereference min="0" max="0"/>
             </elements>
-            <scale name="ABC"/>
         </test>
-        <test name="ABX" interface="AB">
-            <checks>
-                <entry name="fragmentPlayed" support="none"/>
-                <entry name="fragmentFullPlayback" support="none"/>
-                <entry name="fragmentComments" support="none"/>
-            </checks>
-            <show>
-                <entry name="volume" support="none"/>
-                <entry name="page-count" support="none"/>
-                <entry name="playhead" support="none"/>
-                <entry name="comments" support="none"/>
-            </show>
-            <elements>
-                <number min="2" max="2"/>
-                <outsidereference min="1" max="1"/>
-            </elements>
-            <scale name="ABC"/>
-        </test>
+        <test name="ABX" interface="ABX"/>
     </tests>
 </root>
\ No newline at end of file
--- a/test_create/test_core.js	Wed Mar 16 13:31:42 2016 +0000
+++ b/test_create/test_core.js	Wed Mar 16 15:17:04 2016 +0000
@@ -932,8 +932,7 @@
                     }
                     return;
                 }
-                var type = event.currentTarget.getAttribute("type");
-                switch(name) {
+                switch(event.currentTarget.getAttribute("type")) {
                     case "checkbox":
                         eval("this.option."+name+" = event.currentTarget.checked");
                         break;
--- a/test_create/test_create.html	Wed Mar 16 13:31:42 2016 +0000
+++ b/test_create/test_create.html	Wed Mar 16 15:17:04 2016 +0000
@@ -236,19 +236,13 @@
                         var statement = doc.createElement('statement');
                         statement.textContent = this.statement;
                         node.appendChild(statement);
-                        if (this.type != "statement") {
-                            node.id = this.id;
-                            if (this.name != undefined) { node.setAttribute("name",this.name);}
-                            if (this.mandatory != undefined) { node.setAttribute("mandatory",this.mandatory);}
-                            switch(this.type)
-                            {
-                            case "question":
-                                if (this.boxsize != undefined) {node.setAttribute("boxsize",this.boxsize);}
-                                break;
-                            case "number":
-                                if (this.min != undefined) {node.setAttribute("min", this.min);}
-                                if (this.max != undefined) {node.setAttribute("max", this.max);}
-                                break;
+                        node.id = this.id;
+                        if (this.name != undefined) { node.setAttribute("name",this.name);}
+                        if (this.mandatory != undefined) { node.setAttribute("mandatory",this.mandatory);}
+                        node.id = this.id;
+                        if (this.name != undefined) {node.setAttribute("name",this.name);}
+                        switch(this.type)
+                        {
                             case "checkbox":
                             case "radio":
                                 for (var i=0; i<this.options.length; i++)
@@ -259,8 +253,14 @@
                                     optionNode.textContent = option.text;
                                     node.appendChild(optionNode);
                                 }
+                            case "number":
+                                if (this.min != undefined) {node.setAttribute("min", this.min);}
+                                if (this.max != undefined) {node.setAttribute("max", this.max);}
+                            case "question":
+                                if (this.boxsize != undefined) {node.setAttribute("boxsize",this.boxsize);}
+                                if (this.mandatory != undefined) {node.setAttribute("mandatory",this.mandatory);}
+                            default:
                                 break;
-                            }
                         }
                         return node;
                     };