gecko/testing/mochitest/tests/test_MochiKit-Visual.html

108 lines
3.1 KiB
HTML

<html>
<head>
<script type="text/javascript" src="/MochiKit/Base.js"></script>
<script type="text/javascript" src="/MochiKit/Iter.js"></script>
<script type="text/javascript" src="/MochiKit/DOM.js"></script>
<script type="text/javascript" src="/MochiKit/Async.js"></script>
<script type="text/javascript" src="/MochiKit/Style.js"></script>
<script type="text/javascript" src="/MochiKit/Color.js"></script>
<script type="text/javascript" src="/MochiKit/Signal.js"></script>
<script type="text/javascript" src="/MochiKit/New.js"></script>
<script type="text/javascript" src="/MochiKit/Visual.js"></script>
<script type="text/javascript" src="../SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="../SimpleTest/test.css">
<style type="text/css">
#elt1, #elt2, #ctn1 {
visibility: hidden;
}
#ctn1 {
height: 2px;
}
</style>
</head>
<body>
<div id='elt1'>elt1</div>
<div id='ctn1'><div id='elt2'></div></div>
<pre id="test">
<script type="text/javascript">
try {
var TestQueue = function () {
};
TestQueue.prototype = new MochiKit.Visual.ScopedQueue();
MochiKit.Base.update(TestQueue.prototype, {
startLoop: function (func, interval) {
this.started = true;
var timePos = new Date().getTime();
while (this.started) {
timePos += interval;
MochiKit.Base.map(function (effect) {
effect.loop(timePos);
}, this.effects);
}
},
stopLoop: function () {
this.started = false;
},
});
var gl = new TestQueue();
MochiKit.Visual.Queues.instances['global'] = gl;
MochiKit.Visual.Queues.instances['elt1'] = gl;
MochiKit.Visual.Queue = gl;
fade("elt1", {duration: 0, afterFinish: function () {
is(getElement('elt1').style.display, 'none', "fade ok");
}});
appear("elt1", {afterFinish: function () {
is(getElement('elt1').style.display != 'none', true, "appear ok");
}});
toggle("elt1", "size", {afterFinish: function () {
is(getElement('elt1').style.display, 'none', "toggle size ok");
}});
toggle("elt1", "size", {afterFinish: function () {
is(getElement('elt1').style.display != 'none', true, "toggle size reverse ok");
}});
switchOff("elt1", {afterFinish: function () {
is(getElement('elt1').style.display, 'none', "switchOff ok");
}});
slideUp("ctn1", {afterFinish: function () {
is(getElement('elt1').style.display, 'none', "slideUp ok");
}});
slideDown("ctn1", {afterFinish: function () {
is(getElement('elt1').style.display, 'none', "slideDown ok");
}});
ok(true, "visual suite finished");
} catch (err) {
var s = "test suite failure!\n";
var o = {};
var k = null;
for (k in err) {
// ensure unique keys?!
if (!o[k]) {
s += k + ": " + err[k] + "\n";
o[k] = err[k];
}
}
ok ( false, s );
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>