3.0 source code
This commit is contained in:
54
OfficeWeb/vendor/requirejs/tests/delayedDefine/delayedDefine-tests.js
vendored
Normal file
54
OfficeWeb/vendor/requirejs/tests/delayedDefine/delayedDefine-tests.js
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
var globals = {};
|
||||
var master = new doh.Deferred();
|
||||
|
||||
define('a', ['b'], function (b) {
|
||||
globals.a = 'a';
|
||||
});
|
||||
|
||||
define('b', function () {
|
||||
return (globals.b = 'b');
|
||||
});
|
||||
|
||||
define('c', function () {
|
||||
globals.c = 'c';
|
||||
});
|
||||
|
||||
//Register the test
|
||||
doh.register(
|
||||
"delayedDefine",
|
||||
[
|
||||
{
|
||||
name: "delayedDefine",
|
||||
timeout: 5000,
|
||||
runTest: function () {
|
||||
return master;
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
|
||||
//At this point no require calls, so there should be no globals.
|
||||
doh.is(undefined, globals.a);
|
||||
doh.is(undefined, globals.b);
|
||||
doh.is(undefined, globals.c);
|
||||
|
||||
|
||||
require({
|
||||
baseUrl: './'
|
||||
},
|
||||
['a'],
|
||||
function(a) {
|
||||
doh.is('a', globals.a);
|
||||
doh.is('b', globals.b);
|
||||
doh.is(undefined, globals.c);
|
||||
|
||||
setTimeout(function () {
|
||||
//Make sure nothing new is defined after this require callback.
|
||||
doh.is('a', globals.a);
|
||||
doh.is('b', globals.b);
|
||||
doh.is(undefined, globals.c);
|
||||
master.callback(true);
|
||||
}, 15);
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user