| 1 | dojo.provide("dojox.wire.tests.programmatic.TreeAdapter"); |
| 2 | |
| 3 | dojo.require("dojox.wire.TreeAdapter"); |
| 4 | |
| 5 | tests.register("dojox.wire.tests.programmatic.TreeAdapter", [ |
| 6 | |
| 7 | function test_TreeAdapter_nodes(t){ |
| 8 | var source = [ |
| 9 | {a: "A1", b: "B1", c: "C1"}, |
| 10 | {a: "A2", b: "B2", c: "C2"}, |
| 11 | {a: "A3", b: "B3", c: "C3"} |
| 12 | ]; |
| 13 | var nodes = [ |
| 14 | {title: {property: "a"}, children: [ |
| 15 | {node: {property: "b"}}, |
| 16 | {title: {property: "c"}} |
| 17 | ]} |
| 18 | ]; |
| 19 | var value = new dojox.wire.TreeAdapter({object: source, nodes: nodes}).getValue(); |
| 20 | t.assertEqual(source[0].a, value[0].title); |
| 21 | t.assertEqual(source[1].b, value[1].children[0].title); |
| 22 | t.assertEqual(source[2].c, value[2].children[1].title); |
| 23 | } |
| 24 | |
| 25 | ]); |