diff --git a/src/dat/index.js b/src/dat/index.js index 87b1a1e..f3bd18b 100644 --- a/src/dat/index.js +++ b/src/dat/index.js @@ -24,6 +24,7 @@ import NumberControllerBox from './controllers/NumberControllerBox'; import NumberControllerSlider from './controllers/NumberControllerSlider'; import FunctionController from './controllers/FunctionController'; import ColorController from './controllers/ColorController'; +import CustomController from './controllers/CustomController'; import domImport from './dom/dom'; import GUIImport from './gui/GUI'; @@ -43,7 +44,8 @@ export const controllers = { NumberControllerBox: NumberControllerBox, NumberControllerSlider: NumberControllerSlider, FunctionController: FunctionController, - ColorController: ColorController + ColorController: ColorController, + CustomController: CustomController }; export const dom = { dom: domImport }; diff --git a/tests/index.html b/tests/index.html index 6b146c0..62f816a 100644 --- a/tests/index.html +++ b/tests/index.html @@ -25,6 +25,7 @@ var NumberControllerSlider = dat.controllers.NumberControllerSlider; var FunctionController = dat.controllers.FunctionController; var ColorController = dat.controllers.ColorController; + var CustomController = dat.controllers.CustomController; var GUI = dat.gui.GUI; @@ -863,6 +864,22 @@ console.log(c2.__checkbox.getAttribute('checked')); document.body.removeChild(c1.domElement); }); */ + module("CustomController"); + test("Get Custom", function () { + var value = 'value', + c1 = new CustomController({ + constructor: function (controller) { + var input = document.createElement('input'); + input.value = value; + controller.domElement.appendChild(input); + } + }); + document.body.appendChild(c1.domElement); + var input = c1.domElement.getElementsByTagName("input")[0]; + equal(input.value, value , "Input value is the same as the " + value); + document.body.removeChild(c1.domElement); + }); + module("Controller Events"); test("onChange", function() {