simple-badbase.html
2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<html>
<head>
<title>require.js: Simple Bad Base Test</title>
<base href="http://some.example.com/path/" />
<script type="text/javascript">
document.write('<scr' + 'ipt type="text/javascript" src="' + window.parent.doh.dohArgs.setup + '"></scr' + 'ipt>' );
document.write('<scr' + 'ipt type="text/javascript" src="' + window.parent.doh.dohArgs.dojo + '"></scr' + 'ipt>' );
</script>
<script type="text/javascript">
require(
// the set up script sets the base URL
["require", "simple", "dimple", "func", "doh"],
function(require, simple, dimple, func) {
doh.register(
"simple",
[
function colors(t){
t.is("blue", simple.color);
t.is("dimple-blue", dimple.color);
t.is("You called a function", func());
}
]
);
doh.run();
}
);
</script>
<script type="text/javascript">
//This test is only in the HTML since it uses an URL for a require
//argument. It will not work well in say, the Rhino tests.
var path = location.href.replace(/simple-badbase\.html$/, "foo"),
index = path.indexOf(":"),
noProtocolPath = path.substring(index + 1, path.length).replace(/foo/, "bar");
require([path, noProtocolPath, "doh"], function() {
doh.register(
"fooBar",
[
function fooBar(t){
t.is("foo", foo.name);
t.is("bar", bar.name);
}
]
);
doh.run();
});
</script>
</head>
<body>
<h1>require.js: Simple Test</h1>
<p>You may need to change the IP address used for this test for it to work correctly.</p>
<p>Check console for messages</p>
</body>
</html>