source: Dev/trunk/src/client/dojox/mvc/tests/doh/atEquals.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 1.1 KB
Line 
1define([
2        "doh",
3        "dojo/Stateful",
4        "dijit/_WidgetBase",
5        "dojox/mvc/at",
6        "dojox/mvc/equals"
7], function(doh, Stateful, _WidgetBase, at, equals){
8        doh.register("dojox.mvc.tests.doh.atEquals", [
9                function single(){
10                        var a = [0, 1, 2],
11                         model = new Stateful({value: a}),
12                         w = new _WidgetBase({value: at(model, "value").equals(equals)});
13                        w.startup();
14                        model.set("value", a.slice());
15                        doh.is(a, w.value, "The widget should keep the original value");
16                        w.set("value", at(model, "value"));
17                        var copy = a.slice();
18                        model.set("value", copy);
19                        doh.is(copy, w.value, "The widget should be updated with the new value");
20                },
21                function wildcard(){
22                        var a = [0, 1, 2],
23                         model = new Stateful({value: a}),
24                         w = new _WidgetBase({_getPropertiesAttr: function(){ return ["value"]; }, "*": at(model, "*").equals(equals)});
25                        w.startup();
26                        model.set("value", a.slice());
27                        doh.is(a, w.value, "The widget should keep the original value");
28                        w.set("value", at(model, "value"));
29                        var copy = a.slice();
30                        model.set("value", copy);
31                        doh.is(copy, w.value, "The widget should be updated with the new value");
32                }
33        ]);
34});
Note: See TracBrowser for help on using the repository browser.