web-apps/vendor/requirejs/tests/onResourceLoad/nestedRequire-tests.js
Maxim Kadushkin 741b10515d webapps added
2016-03-10 21:48:53 -03:00

45 lines
895 B
JavaScript

var doneCount = 0;
var master = new doh.Deferred();
function finish(a) {
doh.is('a', a.name);
doh.is('b', a.b.name);
doh.is(2, a.ids.length);
doh.is('b', a.ids[0]);
doh.is('a', a.ids[1]);
master.callback(true);
}
requirejs.onResourceLoad = function (context, map, depArray) {
require(["a"], function(a) {
doneCount += 1;
a.add(map.id);
if (doneCount === 2) {
finish(a);
}
});
};
require({
baseUrl: './'
},
['a'],
function(a, b) {
doh.register(
"onResourceLoadNestedRequire",
[
{
name: "onResourceLoadNestedRequire",
timeout: 5000,
runTest: function () {
return master;
}
}
]
);
doh.run();
}
);