forked from requirejs/requirejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueryPath.html
More file actions
56 lines (51 loc) · 1.77 KB
/
queryPath.html
File metadata and controls
56 lines (51 loc) · 1.77 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
56
<!DOCTYPE html>
<html>
<head>
<title>require.js: Querystring Path 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>
require.config({
paths: {
'one': 'one.js?some=thing'
}
});
require(['one', 'two'], function (one, two) {
doh.register(
"queryPath",
[
function queryPath(t){
t.is('large', one.size);
t.is('small', two.size);
//Get all the script tags, make sure the one for
//'one' ends in 'one.js?some=thing' and the one
//for 'two' ends in 'two.js'
var i, tag, id, src,
tags = document.getElementsByTagName('script'),
found = 0;
for (i = tags.length - 1; i > -1; i--) {
tag = tags[i];
id = tag.getAttribute('data-requiremodule');
src = tag.src;
if (id === 'one') {
t.is(true, /one\.js\?some\=thing$/.test(src), 'no .js added');
found += 1;
} else if (id === 'two') {
t.is(true, /two\.js$/.test(src), 'has .js added');
found += 1;
}
}
t.is(2, found);
}
]
);
doh.run();
});
</script>
</head>
<body>
<h1>require.js: Querystring Path Test</h1>
<p>Check console for messages</p>
</body>
</html>