7df7a406fc7e78ea44eb3f57077dbf5048db0bb2.svn-base 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. if (!dojo._hasResource["tests._base._loader.loader"]) { // _hasResource checks
  2. // added by build. Do
  3. // not use _hasResource
  4. // directly in your
  5. // code.
  6. dojo._hasResource["tests._base._loader.loader"] = true;
  7. dojo.provide("tests._base._loader.loader");
  8. tests.register("tests._base._loader.loader", [function baseUrl(t) {
  9. var originalBaseUrl = djConfig["baseUrl"] || "./";
  10. t.assertEqual(originalBaseUrl, dojo.baseUrl);
  11. },
  12. function modulePaths(t) {
  13. dojo.registerModulePath("mycoolmod", "../some/path/mycoolpath");
  14. dojo
  15. .registerModulePath("mycoolmod.widget",
  16. "http://some.domain.com/another/path/mycoolpath/widget");
  17. t.assertEqual("../some/path/mycoolpath/util", dojo
  18. ._getModuleSymbols("mycoolmod.util").join("/"));
  19. t
  20. .assertEqual(
  21. "http://some.domain.com/another/path/mycoolpath/widget",
  22. dojo._getModuleSymbols("mycoolmod.widget")
  23. .join("/"));
  24. t
  25. .assertEqual(
  26. "http://some.domain.com/another/path/mycoolpath/widget/thingy",
  27. dojo
  28. ._getModuleSymbols("mycoolmod.widget.thingy")
  29. .join("/"));
  30. },
  31. function moduleUrls(t) {
  32. dojo.registerModulePath("mycoolmod", "some/path/mycoolpath");
  33. dojo.registerModulePath("mycoolmod2", "/some/path/mycoolpath2");
  34. dojo
  35. .registerModulePath("mycoolmod.widget",
  36. "http://some.domain.com/another/path/mycoolpath/widget");
  37. var basePrefix = dojo.baseUrl;
  38. // dojo._Uri will strip off "./" characters, so do the same here
  39. if (basePrefix == "./") {
  40. basePrefix = "";
  41. }
  42. t.assertEqual(basePrefix
  43. + "some/path/mycoolpath/my/favorite.html", dojo
  44. .moduleUrl("mycoolmod", "my/favorite.html")
  45. .toString());
  46. t.assertEqual(basePrefix
  47. + "some/path/mycoolpath/my/favorite.html", dojo
  48. .moduleUrl("mycoolmod.my", "favorite.html")
  49. .toString());
  50. t.assertEqual("/some/path/mycoolpath2/my/favorite.html", dojo
  51. .moduleUrl("mycoolmod2", "my/favorite.html")
  52. .toString());
  53. t.assertEqual("/some/path/mycoolpath2/my/favorite.html", dojo
  54. .moduleUrl("mycoolmod2.my", "favorite.html")
  55. .toString());
  56. t
  57. .assertEqual(
  58. "http://some.domain.com/another/path/mycoolpath/widget/my/favorite.html",
  59. dojo.moduleUrl("mycoolmod.widget",
  60. "my/favorite.html").toString());
  61. t
  62. .assertEqual(
  63. "http://some.domain.com/another/path/mycoolpath/widget/my/favorite.html",
  64. dojo.moduleUrl("mycoolmod.widget.my",
  65. "favorite.html").toString());
  66. }]);
  67. }