1 if(!dojo._hasResource["tests._base._loader.bootstrap"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["tests._base._loader.bootstrap"] = true;
3 dojo.provide("tests._base._loader.bootstrap");
5 tests.register("tests._base._loader.bootstrap",
8 function hasConsole(t){
9 t.assertTrue("console" in dojo.global);
10 t.assertTrue("assert" in console);
11 t.assertEqual("function", typeof console.assert);
17 //Set an object in global scope.
18 dojo.global.globalValue = {
23 //Set up an object in a specific scope.
32 //Test for existing object using global as root path.
33 var globalVar = dojo.getObject("globalValue");
34 t.is("object", (typeof globalVar));
35 t.assertEqual("blue", globalVar.color);
36 t.assertEqual(20, globalVar.size);
37 t.assertEqual("blue", dojo.getObject("globalValue.color"));
39 //Test for non-existent object using global as root path.
41 t.assertFalse(dojo.getObject("something.thatisNew"));
42 t.assertTrue(typeof(dojo.getObject("something.thatisNew", true)) == "object");
44 //Test for existing object using another object as root path.
45 var scopedVar = dojo.getObject("foo.bar", false, this);
46 t.assertTrue(typeof(scopedVar) == "object");
47 t.assertEqual("red", scopedVar.color);
48 t.assertEqual(100, scopedVar.size);
49 t.assertEqual("red", dojo.getObject("foo.bar.color", true, this));
51 //Test for existing object using another object as root path.
53 t.assertFalse(dojo.getObject("something.thatisNew", false, this));
54 t.assertTrue(typeof(dojo.getObject("something.thatisNew", true, this)) == "object");
57 //Clean up global object that should not exist if
60 delete dojo.global.something;
61 delete this.something;
74 t.assertTrue(dojo.exists("foo.bar", this));
75 t.assertFalse(dojo.exists("foo.bar"));
79 function evalWorks(t){
80 t.assertTrue(dojo.eval("(true)"));
81 t.assertFalse(dojo.eval("(false)"));