later.html revision da9c5db470b1794cbe2976bb24b1a0e68dcabfb4
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Later Tests</title>
</head>
<body class="yui3-skin-sam">
<h1>Later Tests</h1>
<p><input type="button" value="Run Tests" id="btnRun" disabled="true" /></p>
<script type="text/javascript" src="/build/yui/yui.js"></script>
<script type="text/javascript">
var YUI_config = {
gconfig: true
};
YUI({
filter: "debug",
logExclude: {Dom: true, Selector: true, Node: true, attribute: true, base: true, event: true, widget: true}
}).use("dump", "test", "console", function(Y) {
var button = Y.one('#btnRun');
// Set up the page
button.set("disabled", false);
Y.on("click", function() {
Y.Test.Runner.run();
}, button);
var myConsole = new Y.Console().render();
var testCore = new Y.Test.Case({
name: "Lang tests",
test_later: function() {
var data = {
foo: 'bar'
}, count = 0;;
Y.Lang.later(0, null, function(o) {
count++;
Y.Assert.areEqual('bar', o.foo);
}, data)
this.wait(function() {
Y.Assert.areEqual(1, count);
}, 5);
},
test_native: function() {
// fails in IE, YUI 3.3.0 and below
var baz;
var data = [function() {
baz = "boo";
}, 0];
Y.Lang.later(0, null, setTimeout, data)
this.wait(function() {
this.wait(function() {
Y.Assert.areEqual('boo', baz);
}, 5);
}, 5);
}
});
Y.Test.Runner.add(testCore);
Y.Test.Runner.run();
});
</script>
</body>
</html>