| 1 | define(["doh","dojo/_base/declare","dijit/_WidgetBase","dojox/dtl/_Templated"], function(doh, declare, _WidgetBase, _Templated) { |
| 2 | var Test = declare([_WidgetBase, _Templated], { |
| 3 | templateString: "<div>foo</div>" |
| 4 | }); |
| 5 | doh.register("dojox.dtl.tests._Templated", [ |
| 6 | function test_create(t) { |
| 7 | var ui = Test(); |
| 8 | t.is("foo", ui.domNode.innerHTML); |
| 9 | ui.destroy(); |
| 10 | }, |
| 11 | |
| 12 | function test_create_multiple(t) { |
| 13 | var root = document.createElement("div"); |
| 14 | var ui1 = Test(); |
| 15 | var ui2 = Test(); |
| 16 | ui1.placeAt(root, "last"); |
| 17 | ui2.placeAt(root, "last"); |
| 18 | t.is("foo", ui1.domNode.innerHTML); |
| 19 | t.is("foo", ui2.domNode.innerHTML); |
| 20 | t.is(2, root.children.length, "root should have two children"); |
| 21 | ui1.destroy(); |
| 22 | ui2.destroy(); |
| 23 | } |
| 24 | ]); |
| 25 | }); |