8b8c4c9b543333be5200f115b6a9e6bcd7241b4f.svn-base 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. if (!dojo._hasResource["dojox.wire.tests.programmatic.TreeAdapter"]) { // _hasResource
  2. // checks
  3. // added
  4. // by
  5. // build.
  6. // Do
  7. // not
  8. // use
  9. // _hasResource
  10. // directly
  11. // in
  12. // your
  13. // code.
  14. dojo._hasResource["dojox.wire.tests.programmatic.TreeAdapter"] = true;
  15. dojo.provide("dojox.wire.tests.programmatic.TreeAdapter");
  16. dojo.require("dojox.wire.TreeAdapter");
  17. tests.register("dojox.wire.tests.programmatic.TreeAdapter", [
  18. function test_TreeAdapter_nodes(t) {
  19. var source = [{
  20. a : "A1",
  21. b : "B1",
  22. c : "C1"
  23. }, {
  24. a : "A2",
  25. b : "B2",
  26. c : "C2"
  27. }, {
  28. a : "A3",
  29. b : "B3",
  30. c : "C3"
  31. }];
  32. var nodes = [{
  33. title : {
  34. property : "a"
  35. },
  36. children : [{
  37. node : {
  38. property : "b"
  39. }
  40. }, {
  41. title : {
  42. property : "c"
  43. }
  44. }]
  45. }];
  46. var value = new dojox.wire.TreeAdapter({
  47. object : source,
  48. nodes : nodes
  49. }).getValue();
  50. t.assertEqual(source[0].a, value[0].title);
  51. t.assertEqual(source[1].b, value[1].children[0].title);
  52. t.assertEqual(source[2].c, value[2].children[1].title);
  53. }
  54. ]);
  55. }