サンプル doh テスト ケースを実行しようとしています。dijit/layout/ContentPane から mixin するテンプレート化されたウィジェットをテストしています。
エラーはスローされていません...コンポーネントは単にレンダリングされません。テンプレートファイルはfirebugのネットタブにあるので読み込んでいますが、テンプレート化されたウィジェットに「アタッチ」されていないようです。ContentPane ミックスインを削除すると、期待どおりに機能します。
私たちのプロジェクトでは ContentPane を使用して、多くの場所でテンプレート化されたウィジェットにミックスインするため、ウィジェットをレイアウト ウィジェットとして扱うことができます。この問題は、doh でロードしようとしたときにのみ発生します。
ロードしようとしているウィジェット:
define([
'dijit/layout/ContentPane',
'dijit/_WidgetsInTemplateMixin',
'dijit/_TemplatedMixin',
'dijit/_WidgetBase',
'dojo/_base/declare',
'dojo/text!./about.html'
], function(ContentPane, WidgetsInTemplateMixin, TemplatedMixin, WidgetBase, declare, about) {
return declare([ContentPane, TemplatedMixin, WidgetsInTemplateMixin], {
templateString: about,
constructor: function() {
this.inherited(arguments);
},
startup: function() {
this.inherited(arguments);
}
});
});
テンプレート:
<div>
<div>
<h1>foo</h1>
</div>
</div>
doh テスト ランナー ページ:
<body class="claro">
<div style="height: 100%">
<div id="mainContainer"
style="height: 100%; width: 100%"
data-dojo-type="dijit/layout/BorderContainer">
<div data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region: 'center'">
<div data-dojo-type="testPackage/widgets/About/About"
style="width: 100px; height: 100px; background-color: green">
</div>
</div>
</div>
</div>
<script type="text/javascript">
require([
'dojo/ready',
'dojo/parser',
'dojo/dom-style',
'dojo/query',
'dojo',
'doh'
], function(ready, parser, domStyle, query, dojo, doh){
ready(function() {
parser.parse();
doh.register("t", [
function setup(t){
var d = new doh.Deferred();
d.callback(true);
return d;
}
]
);
doh.run();
});
});
</script>
</body>
テンプレート html ファイルの「foo」テキストが表示されない