diff test_create/test_core.js @ 3108:1ae8c03dd6a6

Merge branch 'master' into vnext # Conflicts: # test_create.html # test_create/test_core.js
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Tue, 10 Apr 2018 10:22:34 +0100
parents fc9718756d55 f99b888f57e9
children 3dcdada1058f
line wrap: on
line diff
--- a/test_create/test_core.js	Sun Feb 04 11:16:45 2018 +0000
+++ b/test_create/test_core.js	Tue Apr 10 10:22:34 2018 +0100
@@ -115,6 +115,7 @@
     get("xml/test-schema.xsd").then(function (text) {
         specification.processSchema(text);
         $s.globalSchema = specification.getSchema();
+        $s.$apply();
     });
     $s.availableInterfaceModules = [];
     get("interfaces/interfaces.json").then(JSON.parse).then(function (d) {
@@ -211,12 +212,12 @@
         $($e[0]).modal('hide');
     }
     $s.next = function () {
-        if (($s.state === 0 && $s.file) || $s.state === 1) {
+        if (($s.state === 1 && $s.file) || $s.state === 2) {
             $s.initialise($s.selected);
             if ($s.selected != "AB" && $s.selected != "ABX") {
                 $s.close();
             }
-        } else if ($s.state === 2 && $s.audioFragments.length > 0) {
+        } else if ($s.state === 3 && $s.audioFragments.length > 0) {
             // Populate the audio pages by creating a pairwise set of pairs
             $s.populatePages((function (a) {
                 var b = [];
@@ -231,7 +232,7 @@
                 return b;
             })($s.audioFragments));
             $s.close();
-        } else if ($s.state > 2) {
+        } else if ($s.state > 3) {
             $s.close();
         }
         $s.state++;
@@ -243,6 +244,15 @@
     $s.back = function () {
         $s.state--;
     };
+
+    $s.$watch(function () {
+        return ($s.globalSchema !== undefined)
+    }, function () {
+        if ($s.globalSchema !== undefined && $s.state === 0) {
+            $s.state = 1;
+        }
+    })
+
     $s.mouseover = function (name) {
         var obj = $s.testSpecifications.interfaces.find(function (i) {
             return i.name == name;