3.0 source code
This commit is contained in:
4
OfficeWeb/vendor/requirejs/tests/undef/globalFoo.js
vendored
Normal file
4
OfficeWeb/vendor/requirejs/tests/undef/globalFoo.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
var globalFoo = {
|
||||
name: 'globalFoo'
|
||||
};
|
||||
|
||||
3
OfficeWeb/vendor/requirejs/tests/undef/real.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/undef/real.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define({
|
||||
name: 'real'
|
||||
});
|
||||
66
OfficeWeb/vendor/requirejs/tests/undef/undef.html
vendored
Normal file
66
OfficeWeb/vendor/requirejs/tests/undef/undef.html
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<!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() {
|
||||
doneCount += 1;
|
||||
//alert("done");
|
||||
if (doneCount == 2) {
|
||||
//alert("master callback");
|
||||
master.callback(true);
|
||||
}
|
||||
}
|
||||
|
||||
requirejs.onError = function (err) {
|
||||
var id = err.requireModules[0],
|
||||
config = {paths: {}};
|
||||
|
||||
requirejs.undef(id);
|
||||
config.paths[id] = 'real';
|
||||
|
||||
requirejs.config(config);
|
||||
|
||||
requirejs(['dep'], function (dep) {
|
||||
doh.is("real", dep.name);
|
||||
done();
|
||||
});
|
||||
return;
|
||||
|
||||
throw err;
|
||||
};
|
||||
|
||||
requirejs({
|
||||
waitSeconds: 2,
|
||||
enforceDefine: true
|
||||
}, ['dep'], function (dep) {
|
||||
doh.is("real", dep.name);
|
||||
done();
|
||||
});
|
||||
|
||||
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>
|
||||
77
OfficeWeb/vendor/requirejs/tests/undef/undefEnforceShim.html
vendored
Normal file
77
OfficeWeb/vendor/requirejs/tests/undef/undefEnforceShim.html
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
<!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() {
|
||||
doneCount += 1;
|
||||
//alert("done");
|
||||
if (doneCount == 2) {
|
||||
//alert("master callback");
|
||||
master.callback(true);
|
||||
}
|
||||
}
|
||||
|
||||
requirejs.onError = 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 (dep) {
|
||||
|
||||
doh.is("real", dep.name);
|
||||
done();
|
||||
});
|
||||
return;
|
||||
|
||||
throw err;
|
||||
};
|
||||
|
||||
requirejs({
|
||||
waitSeconds: 2,
|
||||
enforceDefine: true,
|
||||
shim: {
|
||||
'globalFoo': {
|
||||
exports: 'globalFoo'
|
||||
}
|
||||
}
|
||||
}, ['globalFoo', 'dep'], function (globalFoo, dep) {
|
||||
doh.is("globalFoo", globalFoo.name);
|
||||
doh.is("real", dep.name);
|
||||
done();
|
||||
});
|
||||
|
||||
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>
|
||||
57
OfficeWeb/vendor/requirejs/tests/undef/undefLocal.html
vendored
Normal file
57
OfficeWeb/vendor/requirejs/tests/undef/undefLocal.html
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<!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>
|
||||
50
OfficeWeb/vendor/requirejs/tests/undef/undefNoRequire.html
vendored
Normal file
50
OfficeWeb/vendor/requirejs/tests/undef/undefNoRequire.html
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: requirejs.undef() No Require 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 master = new doh.Deferred();
|
||||
|
||||
doh.register(
|
||||
"undefNoRequire",
|
||||
[
|
||||
{
|
||||
name: "undefNoRequire",
|
||||
timeout: 2000,
|
||||
runTest: function () {
|
||||
return master;
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
|
||||
//Start with a bad definition we want to overwrite
|
||||
define('abc', function() {
|
||||
master.errback(false);
|
||||
});
|
||||
|
||||
//Should remove that waiting 'abc' definition
|
||||
requirejs.undef('abc');
|
||||
|
||||
//Now set the final version.
|
||||
define('abc', function() {
|
||||
master.callback(true);
|
||||
});
|
||||
|
||||
//And now fully execute the module.
|
||||
require(['abc'], function() {});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: requirejs.undef() No Require Test</h1>
|
||||
<p>Use requirejs.undef() to reset, but called before the first require()
|
||||
for the module.
|
||||
<a href="https://github.com/jrburke/requirejs/issues/408">More info</a>.</p>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
52
OfficeWeb/vendor/requirejs/tests/undef/undefNoRequire2.html
vendored
Normal file
52
OfficeWeb/vendor/requirejs/tests/undef/undefNoRequire2.html
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: requirejs.undef() No Require 2 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 master = new doh.Deferred();
|
||||
|
||||
doh.register(
|
||||
"undefNoRequire",
|
||||
[
|
||||
{
|
||||
name: "undefNoRequire",
|
||||
timeout: 2000,
|
||||
runTest: function () {
|
||||
return master;
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
|
||||
//Start with a bad definition we want to overwrite
|
||||
define('abc', function() {
|
||||
master.errback(false);
|
||||
});
|
||||
|
||||
define('b', {});
|
||||
|
||||
//Should remove that waiting 'abc' definition
|
||||
requirejs.undef('abc');
|
||||
|
||||
//Now set the final version.
|
||||
define('abc', function() {
|
||||
master.callback(true);
|
||||
});
|
||||
|
||||
//And now fully execute the module.
|
||||
require(['abc'], function() {});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: requirejs.undef() No Require 2 Test</h1>
|
||||
<p>Use requirejs.undef() to reset, but called before the first require()
|
||||
for the module. Like undefRequire.html, but with another module in the queue.
|
||||
<a href="https://github.com/jrburke/requirejs/issues/925">More info</a>.</p>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user