web-apps/vendor/requirejs/tests/undef/undefLocal.html
Maxim Kadushkin 741b10515d webapps added
2016-03-10 21:48:53 -03:00

58 lines
1.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>require.js: requirejs.undef() Test</title>
<script type="text/javascript" src="../../require.js"></script>
<script type="text/javascript" src="../doh/runner.js"></script>
<script type="text/javascript" src="../doh/_browserRunner.js"></script>
<script type="text/javascript">
var doneCount = 0;
var master = new doh.Deferred();
function done() {
master.callback(true);
}
requirejs({
waitSeconds: 2,
enforceDefine: true
}, ['dep'], function (dep) {
doh.is("real", dep.name);
done();
}, function (err) {
var id = err.requireModules[0],
config = {paths: {}};
if (id !== 'dep') {
throw new Error('onError was expecting "dep" but got: ' + id);
}
requirejs.undef(id);
config.paths[id] = 'real';
requirejs.config(config);
requirejs(['dep'], function () {});
});
doh.register(
"undef",
[
{
name: "undef",
timeout: 5000,
runTest: function () {
return master;
}
}
]
);
doh.run();
</script>
</head>
<body>
<h1>require.js: requirejs.undef() Test</h1>
<p>Use requirejs.undef() to reset and load a module from a different path.</p>
<p>Check console for messages</p>
</body>
</html>