3.0 source code
This commit is contained in:
56
OfficeWeb/vendor/requirejs/tests/requirePluginLoad/requirePluginLoad-tests.js
vendored
Normal file
56
OfficeWeb/vendor/requirejs/tests/requirePluginLoad/requirePluginLoad-tests.js
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
var globals = {};
|
||||
|
||||
define('plug',{
|
||||
load: function () {
|
||||
throw new Error('Cannot dynamically load');
|
||||
}
|
||||
});
|
||||
|
||||
define('app/test',[], function() {
|
||||
return { name: 'test' };
|
||||
});
|
||||
|
||||
define('app/test2',[], function() {
|
||||
return { name: 'test2' };
|
||||
});
|
||||
|
||||
define('plug!app/main',["!app/test", "!app/test2"], function(test, test2) {
|
||||
return {
|
||||
name: 'main',
|
||||
test: test,
|
||||
test2: test2
|
||||
};
|
||||
});
|
||||
|
||||
require(["plug!app/main"],
|
||||
function(main) {
|
||||
globals.main = main;
|
||||
}
|
||||
);
|
||||
define("app/run", function(){});
|
||||
|
||||
|
||||
require({
|
||||
baseUrl: "./"
|
||||
},
|
||||
["app/run"],
|
||||
function() {
|
||||
require(["plug!app/main"], function () {
|
||||
doh.register(
|
||||
"requirePluginLoad",
|
||||
[
|
||||
function requirePluginLoad(t){
|
||||
var main = globals.main;
|
||||
|
||||
t.is("main", main.name);
|
||||
t.is("test", main.test.name);
|
||||
t.is("test2", main.test2.name);
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
doh.run();
|
||||
});
|
||||
}
|
||||
);
|
||||
18
OfficeWeb/vendor/requirejs/tests/requirePluginLoad/requirePluginLoad.html
vendored
Normal file
18
OfficeWeb/vendor/requirejs/tests/requirePluginLoad/requirePluginLoad.html
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Require Plugin Load 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" src="requirePluginLoad-tests.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Require Plugin Load Test</h1>
|
||||
<p>Make sure two requires in a built file that has inlined plugin
|
||||
resources do not call the plugin's load method. See
|
||||
<a href="https://github.com/jrburke/requirejs/issues/256">ticket 256</a>
|
||||
for more information.</p>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user