3.0 source code
This commit is contained in:
53
OfficeWeb/vendor/requirejs/tests/text/textOnXhr.html
vendored
Normal file
53
OfficeWeb/vendor/requirejs/tests/text/textOnXhr.html
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Text onXhr 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 fired = false;
|
||||
|
||||
require({
|
||||
baseUrl: "./",
|
||||
paths: {
|
||||
text: "../../../text/text"
|
||||
},
|
||||
config: {
|
||||
text: {
|
||||
onXhr: function (xhr, url) {
|
||||
doh.is(true, !!xhr);
|
||||
doh.is(true, url.indexOf('plain.txt') !== -1);
|
||||
fired = true;
|
||||
if (/\.txt$/.test(url) && xhr.overrideMimeType) {
|
||||
xhr.overrideMimeType('text/plain; charset=utf8');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
require(
|
||||
["text!plain.txt"],
|
||||
function(plainText) {
|
||||
doh.register(
|
||||
"textonXhr",
|
||||
[
|
||||
function textOnXhr(t){
|
||||
t.is(true, plainText.indexOf('hello world') === 0);
|
||||
t.is(true, fired);
|
||||
}
|
||||
]
|
||||
);
|
||||
doh.run();
|
||||
|
||||
}
|
||||
);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>require.js: Text onXhr Test</h1>
|
||||
<p>Test onXhr for the text plugin.
|
||||
<p>Check console for messages</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user