Updated
This commit is contained in:
58
master/examples/text.html
Normal file
58
master/examples/text.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Text Test</title>
|
||||
<script type="text/javascript">
|
||||
requirejsArgs= {
|
||||
dojoLocation:"../../../../.."
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../requirejs-setup.js"></script>
|
||||
<script type="text/javascript" src="../../../../../dojo.js"></script>
|
||||
<script type="text/javascript">
|
||||
// alias dojo's text module to text!
|
||||
if(dohArgs.aliasTest){
|
||||
require({aliases:[
|
||||
["text", "dojo/text"]
|
||||
]});
|
||||
}else{
|
||||
define("text", ["dojo/text"], function(text){ return text; });
|
||||
}
|
||||
|
||||
require(["doh"], function(doh){
|
||||
require({
|
||||
baseUrl: "./",
|
||||
paths: {
|
||||
text: "../../text"
|
||||
} //, priority: ['widgetlayer']
|
||||
},
|
||||
["require", "widget", "local", "text!resources/sample.html!strip"],
|
||||
function(require, widget, local, sampleText) {
|
||||
doh.register(
|
||||
"text",
|
||||
[
|
||||
function text(t){
|
||||
function check(expected, actual){
|
||||
t.is(expected, actual.replace(/\n/g, ""));
|
||||
}
|
||||
check("<span>Hello World!</span>", sampleText);
|
||||
check('<div data-type="widget"><h1>This is a widget!</h1><p>I am in a widget</p></div>', widget.template);
|
||||
check('subwidget', widget.subWidgetName);
|
||||
check('<div data-type="subwidget"><h1>This is a subwidget</h1></div>', widget.subWidgetTemplate);
|
||||
check('<span>This! is template2</span>', widget.subWidgetTemplate2);
|
||||
check('<h1>Local</h1>', local.localHtml);
|
||||
}
|
||||
]
|
||||
);
|
||||
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>
|
||||
Reference in New Issue
Block a user