(function () {
define('text',[],function () {
var text = {
load: function (name, req, onLoad, config) {
throw "THE TEXT PLUGIN LOAD() FUNCTION SHOULD NOT BE CALLED";
}
};
return text;
});
}());
define('text!subwidget.html!strip', function () { return '
This is a subwidget
';});
define('text!subwidget2.html', function () { return 'This! is template2';});
define("subwidget",
["text!subwidget.html!strip", "text!subwidget2.html"],
function(template, template2) {
return {
name: "subwidget",
template: template,
template2: template2
};
}
);
define('text!widget.html', function () { return 'This is a widget!
I am in a widget
';});
define("widget",
["subwidget", "text!widget.html"],
function(subwidget, template) {
return {
subWidgetName: subwidget.name,
subWidgetTemplate: subwidget.template,
subWidgetTemplate2: subwidget.template2,
template: template
};
}
);
/****************** TEST CODE IS BELOW ******************/
require({
baseUrl: "./",
paths: {
text: "../../../text/text"
}
});
require(
["widget"],
function(widget) {
doh.register(
"text",
[
function text(t){
t.is('This is a widget!
I am in a widget
', widget.template);
t.is('subwidget', widget.subWidgetName);
t.is('This is a subwidget
', widget.subWidgetTemplate);
t.is('This! is template2', widget.subWidgetTemplate2);
}
]
);
doh.run();
}
);