55 lines
1.8 KiB
HTML
55 lines
1.8 KiB
HTML
|
<!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>
|