3.0 source code
This commit is contained in:
8
OfficeWeb/vendor/requirejs/tests/paths/first.js/first.js
vendored
Normal file
8
OfficeWeb/vendor/requirejs/tests/paths/first.js/first.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
globalCounter += 1;
|
||||
|
||||
define(['./second'], function (second) {
|
||||
globalCounter += 1;
|
||||
return {
|
||||
load: second
|
||||
};
|
||||
});
|
||||
8
OfficeWeb/vendor/requirejs/tests/paths/first.js/second.js
vendored
Normal file
8
OfficeWeb/vendor/requirejs/tests/paths/first.js/second.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
define(['./first'], function () {
|
||||
return function (id, parentRequire, loaded) {
|
||||
loaded({
|
||||
name: 'first',
|
||||
secondName: 'second'
|
||||
});
|
||||
};
|
||||
});
|
||||
6
OfficeWeb/vendor/requirejs/tests/paths/impl/array.js
vendored
Normal file
6
OfficeWeb/vendor/requirejs/tests/paths/impl/array.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
define(['./util'], function (util) {
|
||||
return {
|
||||
name: 'impl/array',
|
||||
utilName: util.name
|
||||
};
|
||||
});
|
||||
3
OfficeWeb/vendor/requirejs/tests/paths/impl/util.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/paths/impl/util.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define({
|
||||
name: 'impl/util'
|
||||
});
|
||||
54
OfficeWeb/vendor/requirejs/tests/paths/paths.html
vendored
Normal file
54
OfficeWeb/vendor/requirejs/tests/paths/paths.html
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: paths 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 globalCounter = 0,
|
||||
scriptCounter = 0;
|
||||
require({
|
||||
baseUrl: "./",
|
||||
packages: [
|
||||
{
|
||||
name:"first",
|
||||
location:"first.js",
|
||||
main:"./first"
|
||||
}
|
||||
]
|
||||
},
|
||||
["require", "first!whatever"],
|
||||
function(require, first) {
|
||||
doh.register(
|
||||
"paths",
|
||||
[
|
||||
function paths(t){
|
||||
//First confirm there is only one script tag for each
|
||||
//module:
|
||||
var scripts = document.getElementsByTagName("script"),
|
||||
i, counts = {}, modName, props, something;
|
||||
for (var i = scripts.length - 1; i > -1; i--) {
|
||||
modName = scripts[i].getAttribute("data-requiremodule");
|
||||
if (modName && modName === "first" || modName === "first/first") {
|
||||
scriptCounter += 1;
|
||||
}
|
||||
}
|
||||
|
||||
t.is(1, scriptCounter);
|
||||
t.is(2, globalCounter);
|
||||
t.is("first", first.name);
|
||||
t.is("second", first.secondName);
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
}
|
||||
);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: paths Test</h1>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
21
OfficeWeb/vendor/requirejs/tests/paths/relativeModuleId-tests.js
vendored
Normal file
21
OfficeWeb/vendor/requirejs/tests/paths/relativeModuleId-tests.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
require({
|
||||
baseUrl: "./",
|
||||
paths: {
|
||||
"array": "impl/array"
|
||||
}
|
||||
},
|
||||
["require", "array"],
|
||||
function(require, array) {
|
||||
doh.register(
|
||||
"relativeModuleId",
|
||||
[
|
||||
function relativeModuleId(t){
|
||||
t.is("impl/array", array.name);
|
||||
t.is("util", array.utilName);
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
doh.run();
|
||||
}
|
||||
);
|
||||
13
OfficeWeb/vendor/requirejs/tests/paths/relativeModuleId.html
vendored
Normal file
13
OfficeWeb/vendor/requirejs/tests/paths/relativeModuleId.html
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Relative Module ID Test</title>
|
||||
<script type="text/javascript" src="../doh/runner.js"></script>
|
||||
<script type="text/javascript" src="../doh/_browserRunner.js"></script>
|
||||
<script type="text/javascript" data-main="relativeModuleId-tests" src="../../require.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Relative Module ID Test</h1>
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
6
OfficeWeb/vendor/requirejs/tests/paths/relativeNormalize/bar/baz.js
vendored
Normal file
6
OfficeWeb/vendor/requirejs/tests/paths/relativeNormalize/bar/baz.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
define(function (require) {
|
||||
return {
|
||||
name: 'baz',
|
||||
foo: require('./foo')
|
||||
};
|
||||
});
|
||||
3
OfficeWeb/vendor/requirejs/tests/paths/relativeNormalize/foo2.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/paths/relativeNormalize/foo2.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define({
|
||||
name: 'foo2'
|
||||
});
|
||||
21
OfficeWeb/vendor/requirejs/tests/paths/relativeNormalize/relativeNormalize-tests.js
vendored
Normal file
21
OfficeWeb/vendor/requirejs/tests/paths/relativeNormalize/relativeNormalize-tests.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
require({
|
||||
baseUrl: "./",
|
||||
paths: {
|
||||
"bar/foo": "foo2"
|
||||
}
|
||||
},
|
||||
["require", "bar/baz"],
|
||||
function(require, baz) {
|
||||
doh.register(
|
||||
"relativeNormalize",
|
||||
[
|
||||
function relativeNormalize(t){
|
||||
t.is("baz", baz.name);
|
||||
t.is("foo2", baz.foo.name);
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
doh.run();
|
||||
}
|
||||
);
|
||||
17
OfficeWeb/vendor/requirejs/tests/paths/relativeNormalize/relativeNormalize.html
vendored
Normal file
17
OfficeWeb/vendor/requirejs/tests/paths/relativeNormalize/relativeNormalize.html
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Relative Normalize Test</title>
|
||||
<script type="text/javascript" src="../../doh/runner.js"></script>
|
||||
<script type="text/javascript" src="../../doh/_browserRunner.js"></script>
|
||||
<script type="text/javascript" data-main="relativeNormalize-tests" src="../../../require.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Relative Normalize Test</h1>
|
||||
|
||||
<p>Make sure relative require inside a module gets normalized using paths config.
|
||||
More info in <a href="https://github.com/jrburke/requirejs/issues/294">294</a></p>
|
||||
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
3
OfficeWeb/vendor/requirejs/tests/paths/util.js
vendored
Normal file
3
OfficeWeb/vendor/requirejs/tests/paths/util.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
define({
|
||||
name: 'util'
|
||||
});
|
||||
Reference in New Issue
Block a user