3.0 source code
This commit is contained in:
56
OfficeWeb/vendor/requirejs/tests/queryPath.html
vendored
Normal file
56
OfficeWeb/vendor/requirejs/tests/queryPath.html
vendored
Normal file
@@ -0,0 +1,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>
|
||||
Reference in New Issue
Block a user