forked from requirejs/requirejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.html
More file actions
53 lines (50 loc) · 2.3 KB
/
text.html
File metadata and controls
53 lines (50 loc) · 2.3 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
<!DOCTYPE html>
<html>
<head>
<title>require.js: Text 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">
require({
baseUrl: "./",
paths: {
text: "../../text"
} //, priority: ['widgetlayer']
});
require(
["require", "widget", "local", "text!resources/sample.html!strip"],
function(require, widget, local, sampleText) {
doh.register(
"text",
[
function text(t){
t.is("<span>Hello World!</span>", sampleText);
t.is('<div data-type="widget"><h1>This is a widget!</h1><p>I am in a widget</p></div>', widget.template);
t.is('subwidget', widget.subWidgetName);
t.is('<div data-type="subwidget"><h1>This is a subwidget</h1></div>', widget.subWidgetTemplate);
t.is('<span>This! is template2</span>', widget.subWidgetTemplate2);
t.is('<h1>Local</h1>', local.localHtml);
},
function textLocalXhr(t){
var text = require('text');
t.is(true, text.canUseXhr('./some/thing.html', 'http', 'some.domain.com'));
t.is(false, text.canUseXhr('https://some.domain.com/some/thing.html', 'http', 'some.domain.com'));
t.is(false, text.canUseXhr('http://domain.com/some/thing.html', 'http', 'some.domain.com'));
t.is(true, text.canUseXhr('//some.domain.com/some/thing.html', 'http', 'some.domain.com'));
t.is(true, text.canUseXhr('https://some.domain.com:444/some/thing.html', 'https', 'some.domain.com', '444'));
t.is(false, text.canUseXhr('https://some.domain.com/some/thing.html', 'https', 'some.domain.com', '444'));
}
]
);
doh.run();
}
);
</script>
</head>
<body>
<h1>require.js: Text Test</h1>
<p>Test for usage of text! require plugin.
<p>Check console for messages</p>
</body>
</html>