mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Test .removeFolder().
This commit is contained in:
parent
76c80858c3
commit
59f685b018
@ -640,9 +640,9 @@ common.extend(
|
|||||||
|
|
||||||
// Do we have saved appearance data for this folder?
|
// Do we have saved appearance data for this folder?
|
||||||
if (this.load && // Anything loaded?
|
if (this.load && // Anything loaded?
|
||||||
this.load.folders && // Was my parent a dead-end?
|
this.load.folders && // Was my parent a dead-end?
|
||||||
this.load.folders[folder.name]) {
|
this.load.folders[folder.name]) {
|
||||||
delete this.load.folders[folder.name];
|
delete this.load.folders[folder.name];
|
||||||
}
|
}
|
||||||
|
|
||||||
const _this = this;
|
const _this = this;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen"/>
|
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen"/>
|
||||||
<script type="text/javascript" src="qunit.js"></script>
|
<script type="text/javascript" src="qunit.js"></script>
|
||||||
<script type="text/javascript" src="jquery.js"></script>
|
<script type="text/javascript" src="jquery.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="../build/dat.gui.js"></script>
|
<script type="text/javascript" src="../build/dat.gui.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
@ -421,7 +421,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function match(a, b, msg) {
|
function match(a, b, msg) {
|
||||||
|
|
||||||
for (var i in b) {
|
for (var i in b) {
|
||||||
if (b[i] !== b[i]) {
|
if (b[i] !== b[i]) {
|
||||||
ok(a[i] !== a[i], msg)
|
ok(a[i] !== a[i], msg)
|
||||||
@ -429,15 +429,15 @@
|
|||||||
equal(b[i], a[i], msg);
|
equal(b[i], a[i], msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function equalish(a, b, tolerance, label) {
|
function equalish(a, b, tolerance, label) {
|
||||||
return ok(Math.abs(a - b) < tolerance, label);
|
return ok(Math.abs(a - b) < tolerance, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function initObject() {
|
function initObject() {
|
||||||
return {
|
return {
|
||||||
@ -494,9 +494,9 @@
|
|||||||
|
|
||||||
equal(c1.__checkbox.checked,
|
equal(c1.__checkbox.checked,
|
||||||
object.booleanProperty);
|
object.booleanProperty);
|
||||||
|
|
||||||
console.log(c2.__checkbox.getAttribute('checked'));
|
console.log(c2.__checkbox.getAttribute('checked'));
|
||||||
|
|
||||||
equal(c2.__checkbox.getAttribute('checked') === 'checked',
|
equal(c2.__checkbox.getAttribute('checked') === 'checked',
|
||||||
object.anotherBooleanProperty);
|
object.anotherBooleanProperty);
|
||||||
|
|
||||||
@ -518,7 +518,7 @@ console.log(c2.__checkbox.getAttribute('checked'));
|
|||||||
dom.fakeEvent(c1.__checkbox, 'click');
|
dom.fakeEvent(c1.__checkbox, 'click');
|
||||||
equal(true, object.booleanProperty, 'changes back');
|
equal(true, object.booleanProperty, 'changes back');
|
||||||
|
|
||||||
equal(true, c1.__checkbox.checked, 'checkbox valid');
|
equal(true, c1.__checkbox.checked, 'checkbox valid');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -756,7 +756,7 @@ console.log(c2.__checkbox.getAttribute('checked'));
|
|||||||
module("NumberControllerSlider");
|
module("NumberControllerSlider");
|
||||||
|
|
||||||
test("Acknowledges original value", function() {
|
test("Acknowledges original value", function() {
|
||||||
|
|
||||||
var object = initObject();
|
var object = initObject();
|
||||||
|
|
||||||
var min = 0, max = 50;
|
var min = 0, max = 50;
|
||||||
@ -813,7 +813,7 @@ console.log(c2.__checkbox.getAttribute('checked'));
|
|||||||
|
|
||||||
|
|
||||||
dom.fakeEvent(window, 'mouseup');
|
dom.fakeEvent(window, 'mouseup');
|
||||||
|
|
||||||
dom.fakeEvent(window, 'mousemove', {
|
dom.fakeEvent(window, 'mousemove', {
|
||||||
x: o.left+w,
|
x: o.left+w,
|
||||||
y: o.top
|
y: o.top
|
||||||
@ -902,7 +902,7 @@ console.log(c2.__checkbox.getAttribute('checked'));
|
|||||||
c4.onChange(function() {
|
c4.onChange(function() {
|
||||||
c4_changed = true;
|
c4_changed = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
c5.onChange(function() {
|
c5.onChange(function() {
|
||||||
c5_changed = true;
|
c5_changed = true;
|
||||||
});
|
});
|
||||||
@ -1006,7 +1006,7 @@ console.log(c2.__checkbox.getAttribute('checked'));
|
|||||||
return ok(Math.abs(a - b) < tolerance, label);
|
return ok(Math.abs(a - b) < tolerance, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module('GUI Appearance');
|
module('GUI Appearance');
|
||||||
|
|
||||||
@ -1052,7 +1052,7 @@ console.log(c2.__checkbox.getAttribute('checked'));
|
|||||||
gui.destroy();
|
gui.destroy();
|
||||||
}, 0);
|
}, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('close/open button position', function() {
|
test('close/open button position', function() {
|
||||||
|
|
||||||
var gui = new GUI({closeOnTop:true});
|
var gui = new GUI({closeOnTop:true});
|
||||||
@ -1062,12 +1062,12 @@ console.log(c2.__checkbox.getAttribute('checked'));
|
|||||||
ok($(gui.domElement).find('ul').prev().hasClass(GUI.CLASS_CLOSE_BUTTON) && $(gui.domElement).find('ul').prev().hasClass(GUI.CLASS_CLOSE_TOP), 'GUI has close/open button on top');
|
ok($(gui.domElement).find('ul').prev().hasClass(GUI.CLASS_CLOSE_BUTTON) && $(gui.domElement).find('ul').prev().hasClass(GUI.CLASS_CLOSE_TOP), 'GUI has close/open button on top');
|
||||||
ok($(gui2.domElement).find('ul').next().hasClass(GUI.CLASS_CLOSE_BUTTON) && $(gui2.domElement).find('ul').next().hasClass(GUI.CLASS_CLOSE_BOTTOM), 'GUI has close/open button on bottom');
|
ok($(gui2.domElement).find('ul').next().hasClass(GUI.CLASS_CLOSE_BUTTON) && $(gui2.domElement).find('ul').next().hasClass(GUI.CLASS_CLOSE_BOTTOM), 'GUI has close/open button on bottom');
|
||||||
ok($(gui3.domElement).find('ul').next().hasClass(GUI.CLASS_CLOSE_BUTTON) && $(gui3.domElement).find('ul').next().hasClass(GUI.CLASS_CLOSE_BOTTOM), 'GUI has close/open button on bottom by default');
|
ok($(gui3.domElement).find('ul').next().hasClass(GUI.CLASS_CLOSE_BUTTON) && $(gui3.domElement).find('ul').next().hasClass(GUI.CLASS_CLOSE_BOTTOM), 'GUI has close/open button on bottom by default');
|
||||||
|
|
||||||
gui.destroy();
|
gui.destroy();
|
||||||
gui2.destroy();
|
gui2.destroy();
|
||||||
gui3.destroy();
|
gui3.destroy();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Folders', function() {
|
test('Folders', function() {
|
||||||
|
|
||||||
@ -1187,6 +1187,20 @@ console.log(c2.__checkbox.getAttribute('checked'));
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('removeFolder', function() {
|
||||||
|
|
||||||
|
var gui = new GUI();
|
||||||
|
|
||||||
|
var f = gui.addFolder('Temporary folder');
|
||||||
|
|
||||||
|
ok($.contains(gui.domElement, f.domElement), "Now you see it");
|
||||||
|
gui.removeFolder(f);
|
||||||
|
|
||||||
|
ok(!$.contains(gui.domElement, f.domElement), "Now you don't.");
|
||||||
|
|
||||||
|
gui.destroy();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
test('min, max & step', function() {
|
test('min, max & step', function() {
|
||||||
|
|
||||||
@ -1417,11 +1431,11 @@ console.log(c2.__checkbox.getAttribute('checked'));
|
|||||||
equal($(gui.__preset_select).children('option:selected')[0].value, gui.preset, "Dropdown display matches preset value");
|
equal($(gui.__preset_select).children('option:selected')[0].value, gui.preset, "Dropdown display matches preset value");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1 id="qunit-header"></h1>
|
<h1 id="qunit-header"></h1>
|
||||||
@ -1433,4 +1447,4 @@ console.log(c2.__checkbox.getAttribute('checked'));
|
|||||||
<ol id="qunit-tests"></ol>
|
<ol id="qunit-tests"></ol>
|
||||||
<div id="qunit-fixture">test markup, will be hidden</div>
|
<div id="qunit-fixture">test markup, will be hidden</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user