This commit is contained in:
Andrej 2019-04-26 08:35:23 +07:00
parent fc465bfe46
commit ced2ce7880
2 changed files with 20 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import NumberControllerBox from './controllers/NumberControllerBox';
import NumberControllerSlider from './controllers/NumberControllerSlider'; import NumberControllerSlider from './controllers/NumberControllerSlider';
import FunctionController from './controllers/FunctionController'; import FunctionController from './controllers/FunctionController';
import ColorController from './controllers/ColorController'; import ColorController from './controllers/ColorController';
import CustomController from './controllers/CustomController';
import domImport from './dom/dom'; import domImport from './dom/dom';
import GUIImport from './gui/GUI'; import GUIImport from './gui/GUI';
@ -43,7 +44,8 @@ export const controllers = {
NumberControllerBox: NumberControllerBox, NumberControllerBox: NumberControllerBox,
NumberControllerSlider: NumberControllerSlider, NumberControllerSlider: NumberControllerSlider,
FunctionController: FunctionController, FunctionController: FunctionController,
ColorController: ColorController ColorController: ColorController,
CustomController: CustomController
}; };
export const dom = { dom: domImport }; export const dom = { dom: domImport };

View File

@ -25,6 +25,7 @@
var NumberControllerSlider = dat.controllers.NumberControllerSlider; var NumberControllerSlider = dat.controllers.NumberControllerSlider;
var FunctionController = dat.controllers.FunctionController; var FunctionController = dat.controllers.FunctionController;
var ColorController = dat.controllers.ColorController; var ColorController = dat.controllers.ColorController;
var CustomController = dat.controllers.CustomController;
var GUI = dat.gui.GUI; var GUI = dat.gui.GUI;
@ -863,6 +864,22 @@ console.log(c2.__checkbox.getAttribute('checked'));
document.body.removeChild(c1.domElement); 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"); module("Controller Events");
test("onChange", function() { test("onChange", function() {