Container.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2. "http://www.w3.org/TR/html4/strict.dtd">
  3. <html>
  4. <head>
  5. <title>Container</title>
  6. <script type="text/javascript" src="../../dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
  7. <script type="text/javascript">
  8. dojo.require("doh.runner");
  9. dojo.require("dijit._Widget");
  10. dojo.require("dijit._Container");
  11. dojo.declare("dijit.TestContainer",
  12. [dijit._Widget, dijit._Container], { }
  13. );
  14. dojo.require("dojo.parser");
  15. dojo.addOnLoad(function(){
  16. doh.register("t",
  17. [
  18. {
  19. name: "getChildren",
  20. runTest: function(t){
  21. var c = dijit.byId("container");
  22. var children = c.getChildren();
  23. t.is(3, children.length);
  24. t.is("zero", children[0].id);
  25. t.is("one", children[1].id);
  26. t.is("two", children[2].id);
  27. }
  28. },
  29. {
  30. name: "_getSiblingOfChild",
  31. runTest: function(t){
  32. var c = dijit.byId("container");
  33. var children = c.getChildren();
  34. t.is("one", c._getSiblingOfChild(children[0], 1).id);
  35. t.is("two", c._getSiblingOfChild(children[1], 1).id);
  36. t.is(null, c._getSiblingOfChild(children[2], 1));
  37. t.is(null, c._getSiblingOfChild(children[0], -1));
  38. t.is("zero", c._getSiblingOfChild(children[1], -1).id);
  39. t.is("one", c._getSiblingOfChild(children[2], -1).id);
  40. }
  41. }
  42. ]
  43. );
  44. doh.run();
  45. });
  46. </script>
  47. </head>
  48. <body class="tundra">
  49. <div id="container" dojoType="dijit.TestContainer">
  50. <div id="zero" dojoType="dijit._Widget"></div>
  51. <div id="one" dojoType="dijit._Widget"></div>
  52. <div id="two" dojoType="dijit._Widget"></div>
  53. </div>
  54. </body>
  55. </html>