Merge pull request #696 from CarnegieLearningWeb/feature-configInnerFields

Configure inner math field with options
diff --git a/src/commands/math.js b/src/commands/math.js
index 63341e3..c3d0978 100644
--- a/src/commands/math.js
+++ b/src/commands/math.js
@@ -431,7 +431,8 @@
 API.StaticMath = function(APIClasses) {
   return P(APIClasses.AbstractMathQuill, function(_, super_) {
     this.RootBlock = MathBlock;
-    _.__mathquillify = function() {
+    _.__mathquillify = function(opts, interfaceVersion) {
+      this.config(opts);
       super_.__mathquillify.call(this, 'mq-math-mode');
       this.__controller.delegateMouseEvents();
       this.__controller.staticMathTextareaEvents();
diff --git a/src/commands/math/commands.js b/src/commands/math/commands.js
index fdd3cf2..9fa95e1 100644
--- a/src/commands/math/commands.js
+++ b/src/commands/math/commands.js
@@ -788,8 +788,8 @@
       .map(function(name) { self.name = name; }).or(succeed())
       .then(super_.parser.call(self));
   };
-  _.finalizeTree = function() {
-    var ctrlr = Controller(this.ends[L], this.jQ, Options());
+  _.finalizeTree = function(options) {
+    var ctrlr = Controller(this.ends[L], this.jQ, options);
     ctrlr.KIND_OF_MQ = 'MathField';
     ctrlr.editable = true;
     ctrlr.createTextarea();
diff --git a/test/unit/publicapi.test.js b/test/unit/publicapi.test.js
index b15c5de..e4fff58 100644
--- a/test/unit/publicapi.test.js
+++ b/test/unit/publicapi.test.js
@@ -200,11 +200,17 @@
     testHandlers('MQ.MathField() constructor', function(options) {
       return MQ.MathField($('<span></span>').appendTo('#mock')[0], options);
     });
+    testHandlers('MQ.StaticMath() constructor', function(options) {
+      return MQ.StaticMath($('<span>\\MathQuillMathField{}</span>').appendTo('#mock')[0], options).innerFields[0];
+    });
     testHandlers('MQ.MathField::config()', function(options) {
       return MQ.MathField($('<span></span>').appendTo('#mock')[0]).config(options);
     });
-    testHandlers('.config() on \\MathQuillMathField{} in a MQ.StaticMath', function(options) {
-      return MQ.MathField($('<span></span>').appendTo('#mock')[0]).config(options);
+    testHandlers('MQ.StaticMath::config() propagates down to \\MathQuillMathField{}', function(options) {
+      return MQ.StaticMath($('<span>\\MathQuillMathField{}</span>').appendTo('#mock')[0]).config(options).innerFields[0];
+    });
+    testHandlers('.config() directly on a \\MathQuillMathField{} in a MQ.StaticMath using .innerFields', function(options) {
+      return MQ.StaticMath($('<span>\\MathQuillMathField{}</span>').appendTo('#mock')[0]).innerFields[0].config(options);
     });
     suite('global MQ.config()', function() {
       testHandlers('a MQ.MathField', function(options) {