2150 |
mathias |
1 |
if(!dojo._hasResource["dojox.wire.tests.programmatic.TreeAdapter"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
|
|
2 |
dojo._hasResource["dojox.wire.tests.programmatic.TreeAdapter"] = true;
|
|
|
3 |
dojo.provide("dojox.wire.tests.programmatic.TreeAdapter");
|
|
|
4 |
|
|
|
5 |
dojo.require("dojox.wire.TreeAdapter");
|
|
|
6 |
|
|
|
7 |
tests.register("dojox.wire.tests.programmatic.TreeAdapter", [
|
|
|
8 |
|
|
|
9 |
function test_TreeAdapter_nodes(t){
|
|
|
10 |
var source = [
|
|
|
11 |
{a: "A1", b: "B1", c: "C1"},
|
|
|
12 |
{a: "A2", b: "B2", c: "C2"},
|
|
|
13 |
{a: "A3", b: "B3", c: "C3"}
|
|
|
14 |
];
|
|
|
15 |
var nodes = [
|
|
|
16 |
{title: {property: "a"}, children: [
|
|
|
17 |
{node: {property: "b"}},
|
|
|
18 |
{title: {property: "c"}}
|
|
|
19 |
]}
|
|
|
20 |
];
|
|
|
21 |
var value = new dojox.wire.TreeAdapter({object: source, nodes: nodes}).getValue();
|
|
|
22 |
t.assertEqual(source[0].a, value[0].title);
|
|
|
23 |
t.assertEqual(source[1].b, value[1].children[0].title);
|
|
|
24 |
t.assertEqual(source[2].c, value[2].children[1].title);
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
]);
|
|
|
28 |
|
|
|
29 |
}
|