comparison test_create/test_core.js @ 2857:80a3b693b3f6

More test_create work
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Thu, 27 Apr 2017 11:24:16 +0100
parents 5591d01adf1c
children cffde1e75b2d
comparison
equal deleted inserted replaced
2856:5591d01adf1c 2857:80a3b693b3f6
51 get("xml/test-schema.xsd").then(function (text) { 51 get("xml/test-schema.xsd").then(function (text) {
52 specification.processSchema(text); 52 specification.processSchema(text);
53 $s.globalSchema = specification.getSchema(); 53 $s.globalSchema = specification.getSchema();
54 }); 54 });
55 $s.specification = specification; 55 $s.specification = specification;
56
57 $s.addPage = function () {
58 $s.specification.createNewPage();
59 }
56 }]); 60 }]);
57 61
58 AngularInterface.controller("introduction", ['$scope', '$element', '$window', function ($s, $e, $w) { 62 AngularInterface.controller("introduction", ['$scope', '$element', '$window', function ($s, $e, $w) {
59 $s.state = 0; 63 $s.state = 0;
60 $s.next = function () { 64 $s.next = function () {
161 $s.opt.options.push({ 165 $s.opt.options.push({
162 name: "", 166 name: "",
163 text: "" 167 text: ""
164 }); 168 });
165 }; 169 };
170
171 $s.addCondition = function () {
172 $s.opt.conditions.push({
173 check: "equals",
174 value: "",
175 jumpToOnPass: undefined,
176 jumpToOnFail: undefined
177 });
178 };
179
180 $s.removeCondition = function (condition) {
181 var index = $s.opt.conditions.findIndex(function (c) {
182 return c == condition;
183 });
184 if (index === -1) {
185 throw ("Invalid Condition");
186 }
187 $s.opt.conditions.splice(index, 1);
188 };
166 }]); 189 }]);
167 190
168 AngularInterface.controller("interfaceNode", ['$scope', '$element', '$window', function ($s, $e, $w) { 191 AngularInterface.controller("interfaceNode", ['$scope', '$element', '$window', function ($s, $e, $w) {
169 $s.$watch("interface.options.length", function () { 192 $s.$watch("interface.options.length", function () {
170 if (!$s.interface || !$s.interface.options) { 193 if (!$s.interface || !$s.interface.options) {
199 obj.max = $event.currentTarget.parentElement.querySelector("[name=max]").value; 222 obj.max = $event.currentTarget.parentElement.querySelector("[name=max]").value;
200 } 223 }
201 } else if (index >= 0 && !$event.currentTarget.checked) { 224 } else if (index >= 0 && !$event.currentTarget.checked) {
202 $s.interface.options.splice(index, 1); 225 $s.interface.options.splice(index, 1);
203 } 226 }
204 } 227 };
228 $s.removeScale = function (scale) {
229 var index = $s.interface.scales.findIndex(function (s) {
230 return s == scale;
231 });
232 if (index >= 0) {
233 $s.interface.scales.splice(index, 1);
234 }
235 };
236 $s.addScale = function () {
237 $s.interface.scales.push({
238 position: undefined,
239 text: undefined
240 });
241 };
205 }]); 242 }]);
206 AngularInterface.controller("page", ['$scope', '$element', '$window', function ($s, $e, $w) {}]); 243 AngularInterface.controller("page", ['$scope', '$element', '$window', function ($s, $e, $w) {}]);