Line | |
---|
1 | define([ |
---|
2 | "doh", |
---|
3 | "dojo/_base/declare", |
---|
4 | "dojo/Stateful", |
---|
5 | "dijit/registry", |
---|
6 | "dijit/_WidgetBase", |
---|
7 | "dijit/_TemplatedMixin", |
---|
8 | "dijit/_WidgetsInTemplateMixin", |
---|
9 | "dojox/mvc/at", |
---|
10 | "dojox/mvc/_Controller", |
---|
11 | "dojo/text!../templates/_ControllerInTemplate.html" |
---|
12 | ], function(doh, declare, Stateful, registry, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, at, _Controller, template){ |
---|
13 | doh.register("dojox.mvc.tests.doh._Controller", [ |
---|
14 | function destroyFromWidgetsInTemplate(){ |
---|
15 | var w = new (declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], { |
---|
16 | templateString: template |
---|
17 | }))({}, document.createElement("div")); |
---|
18 | w.startup(); |
---|
19 | var ctrl = w.controllerNode, |
---|
20 | id = ctrl.id; |
---|
21 | w.destroy(); |
---|
22 | doh.f(registry.byId(id), "The controller should have been removed from registry along with the template widget"); |
---|
23 | doh.t(ctrl._destroyed, "The controller should have been marked as destroyed along with the template widget"); |
---|
24 | }, |
---|
25 | function useWithDijit(){ |
---|
26 | var model = new Stateful(), |
---|
27 | w = new (declare([_WidgetBase, _Controller], {}))({ |
---|
28 | foo: at(model, "foo") |
---|
29 | }); |
---|
30 | w.startup(); |
---|
31 | model.set("foo", "Foo"); |
---|
32 | doh.is("Foo", w.get("foo"), "Update to model should be reflected to _WidgetBase/Controller mixin"); |
---|
33 | } |
---|
34 | ]); |
---|
35 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.