/trunk/api/js/dojo1.0/dojo/tests/_base/NodeList.html |
---|
New file |
0,0 → 1,370 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
"http://www.w3.org/TR/html4/strict.dtd"> |
<!-- |
we use a strict-mode DTD to ensure that the box model is the same for these |
basic tests |
--> |
<html> |
<head> |
<style type="text/css"> |
@import "../../resources/dojo.css"; |
html, body { |
padding: 0px; |
margin: 0px; |
border: 0px; |
} |
#sq100 { |
background-color: black; |
color: white; |
position: absolute; |
left: 100px; |
top: 100px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding: 0px; |
margin: 0px; |
overflow: hidden; |
} |
</style> |
<title>testing dojo.NodeList</title> |
<script type="text/javascript" src="../../dojo.js" |
djConfig="isDebug: true, noFirebugLite: true"></script> |
<script type="text/javascript"> |
dojo.require("doh.runner"); |
dojo.addOnLoad(function(){ |
var c = dojo.byId("c1"); |
var t = dojo.byId("t"); |
var s = dojo.byId("sq100"); |
var fourElementNL = new dojo.NodeList(c, t, c, t); |
doh.register("t", |
[ |
// constructor tests |
function ctor(){ |
var nl = new dojo.NodeList(); |
nl.push(c); |
doh.is(1, nl.length); |
}, |
function ctorArgs(){ |
var nl = new dojo.NodeList(4); |
nl.push(c); |
doh.is(5, nl.length); |
}, |
function ctorArgs2(){ |
var nl = new dojo.NodeList(c, t); |
doh.is(2, nl.length); |
doh.is(c, nl[0]); |
doh.is(t, nl[1]); |
}, |
// iteration and array tests |
function forEach(){ |
var lastItem; |
var nl = new dojo.NodeList(c, t); |
nl.forEach(function(i){ lastItem = i; }); |
doh.is(t, lastItem); |
var r = nl.forEach(function(i, idx, arr){ |
doh.t(arr.constructor == dojo.NodeList); |
doh.is(2, arr.length); |
}); |
doh.t(r.constructor == dojo.NodeList); |
doh.is(r, nl); |
}, |
function indexOf(){ |
doh.is(0, fourElementNL.indexOf(c)); |
doh.is(1, fourElementNL.indexOf(t)); |
doh.is(-1, fourElementNL.indexOf(null)); |
}, |
function lastIndexOf(){ |
doh.is(2, fourElementNL.lastIndexOf(c)); |
doh.is(3, fourElementNL.lastIndexOf(t)); |
doh.is(-1, fourElementNL.lastIndexOf(null)); |
}, |
function every(){ |
var ctr = 0; |
var ret = fourElementNL.every(function(){ |
ctr++; |
return true; |
}); |
doh.is(4, ctr); |
doh.t(ret); |
ctr = 0; |
var ret = fourElementNL.every(function(){ |
ctr++; |
return false; |
}); |
doh.is(1, ctr); |
doh.f(ret); |
}, |
function some(){ |
var ret = fourElementNL.some(function(){ |
return true; |
}); |
doh.t(ret); |
var ret = fourElementNL.some(function(i){ |
return (i.id == "t"); |
}); |
doh.t(ret); |
}, |
function map(){ |
var ret = fourElementNL.map(function(){ |
return true; |
}); |
doh.is(ret, [true, true, true, true]); |
var cnt = 0; |
var ret = fourElementNL.map(function(){ |
return cnt++; |
}); |
// doh.is(ret, [0, 1, 2, 3]); |
doh.t(ret.constructor == dojo.NodeList); |
// make sure that map() returns a NodeList |
var sum = 0; |
fourElementNL.map(function(){ return 2; }).forEach( function(x){ sum += x; } ); |
doh.is(sum, 8); |
}, |
function slice(){ |
var pnl = new dojo.NodeList(t, t, c); |
doh.is(2, pnl.slice(1).length); |
doh.is(3, pnl.length); |
doh.is(c, pnl.slice(-1)[0]); |
doh.is(2, pnl.slice(-2).length); |
}, |
function splice(){ |
var pnl = new dojo.NodeList(t, t, c); |
console.debug(pnl.splice(1)); |
/* |
doh.is(2, pnl.splice(1).length); |
doh.is(1, pnl.length); |
pnl = new dojo.NodeList(t, t, c); |
doh.is(c, pnl.splice(-1)[0]); |
doh.is(2, pnl.length); |
pnl = new dojo.NodeList(t, t, c); |
doh.is(2, pnl.splice(-2).length); |
*/ |
}, |
function spliceInsert(){ |
// insert 1 |
var pnl = new dojo.NodeList(t, t, c); |
pnl.splice(0, 0, c); |
doh.is(4, pnl.length); |
doh.is(c, pnl[0]); |
// insert multiple |
pnl = new dojo.NodeList(t, t, c); |
pnl.splice(0, 0, c, s); |
doh.is(5, pnl.length); |
doh.is(c, pnl[0]); |
doh.is(s, pnl[1]); |
doh.is(t, pnl[2]); |
// insert multiple at offset |
pnl = new dojo.NodeList(t, t, c); |
pnl.splice(1, 0, c, s); |
doh.is(5, pnl.length); |
doh.is(t, pnl[0]); |
doh.is(c, pnl[1]); |
doh.is(s, pnl[2]); |
doh.is(t, pnl[3]); |
}, |
function spliceDel(){ |
// clobbery 1 |
var pnl = new dojo.NodeList(c, t, s); |
pnl.splice(0, 1); |
doh.is(2, pnl.length); |
doh.is(t, pnl[0]); |
// clobber multiple |
pnl = new dojo.NodeList(c, t, s); |
pnl.splice(0, 2); |
doh.is(1, pnl.length); |
doh.is(s, pnl[0]); |
// ...at an offset |
pnl = new dojo.NodeList(c, t, s); |
pnl.splice(1, 1); |
doh.is(2, pnl.length); |
doh.is(c, pnl[0]); |
doh.is(s, pnl[1]); |
}, |
function spliceInsertDel(){ |
// clobbery 1 |
var pnl = new dojo.NodeList(c, t, s); |
pnl.splice(1, 1, s); |
doh.is(3, pnl.length); |
doh.is(dojo.NodeList(c, s, s), pnl); |
pnl = new dojo.NodeList(c, t, s); |
pnl.splice(1, 2, s); |
doh.is(2, pnl.length); |
doh.is(dojo.NodeList(c, s), pnl); |
}, |
// sub-search |
function query(){ |
var pnl = new dojo.NodeList(t); |
doh.is(c, pnl.query("span")[0]); |
doh.is(t, dojo.query("body").query(":last-child")[0]); |
doh.is(c, dojo.query("body").query(":last-child")[1]); |
doh.is(1, pnl.query().length); |
}, |
function filter(){ |
doh.is(dojo.query("body :first-child").filter(":last-child")[0], c); |
doh.is(1, dojo.query("*").filter(function(n){ return (n.nodeName.toLowerCase() == "span"); }).length); |
var filterObj = { |
filterFunc: function(n){ |
return (n.nodeName.toLowerCase() == "span"); |
} |
}; |
doh.is(1, dojo.query("*").filter(filterObj.filterFunc).length); |
doh.is(1, dojo.query("*").filter(filterObj.filterFunc, filterObj).length); |
}, |
// layout DOM functions |
function coords(){ |
var tnl = new dojo.NodeList(dojo.byId('sq100')) |
doh.t(dojo.isArray(tnl)); |
doh.is(100, tnl.coords()[0].w); |
doh.is(100, tnl.coords()[0].h); |
doh.is(document.body.getElementsByTagName("*").length, dojo.query("body *").coords().length); |
}, |
function styleGet(){ |
// test getting |
var tnl = new dojo.NodeList(s); |
doh.is(1, tnl.style("opacity")[0]); |
tnl.push(t); |
dojo.style(t, "opacity", 0.5); |
doh.is(0.5, tnl.style("opacity").slice(-1)[0]); |
tnl.style("opacity", 1); |
}, |
function styleSet(){ |
// test setting |
var tnl = new dojo.NodeList(s, t); |
tnl.style("opacity", 0.5); |
doh.is(0.5, dojo.style(tnl[0], "opacity")); |
doh.is(0.5, dojo.style(tnl[1], "opacity")); |
// reset |
tnl.style("opacity", 1); |
}, |
function styles(){ |
var tnl = new dojo.NodeList(s, t); |
tnl.styles("opacity", 1); |
doh.is(1, tnl.styles("opacity")[0]); |
dojo.style(t, "opacity", 0.5); |
doh.is(1.0, tnl.styles("opacity")[0]); |
doh.is(0.5, tnl.styles("opacity")[1]); |
// reset things |
tnl.styles("opacity", 1); |
}, |
function concat(){ |
var spans = dojo.query("span"); |
var divs = dojo.query("div"); |
console.debug(spans.concat(divs)); |
doh.is(spans.concat(divs).constructor, dojo.NodeList); |
doh.is((divs.length + spans.length), spans.concat(divs).length); |
}, |
function concat2(t){ |
var spans = dojo.query("span"); |
var divs = dojo.query("div"); |
doh.is(spans.concat([]).constructor, dojo.NodeList); |
}, |
function place(t){ |
var ih = "<div><span></span></div><span class='thud'><b>blah</b></span>"; |
var tn = document.createElement("div"); |
tn.innerHTML = ih; |
dojo.body().appendChild(tn); |
var nl = dojo.query("b", tn).place(tn, "first"); |
doh.t(nl.constructor == dojo.NodeList); |
doh.is(1, nl.length); |
doh.is("b", nl[0].nodeName.toLowerCase()); |
doh.is(tn, nl[0].parentNode); |
doh.is(tn.firstChild, nl[0]); |
}, |
function orphan(t){ |
var ih = "<div><span></span></div><span class='thud'><b>blah</b></span>"; |
var tn = document.createElement("div"); |
tn.innerHTML = ih; |
dojo.body().appendChild(tn); |
var nl = dojo.query("span", tn).orphan(); |
doh.t(nl.constructor == dojo.NodeList); |
doh.is(2, nl.length); |
doh.is(1, tn.getElementsByTagName("*").length); |
tn.innerHTML = ih; |
var nl = dojo.query("*", tn).orphan("b"); |
doh.is(1, nl.length); |
doh.is("blah", nl[0].innerHTML); |
}, |
/* |
// FIXME |
function adopt(t){ |
}, |
function addContent(t){ |
}, |
*/ |
function connect(t){ |
var ih = "<div><span></span></div><span class='thud'><button>blah</button></span>"; |
var tn = document.createElement("div"); |
tn.innerHTML = ih; |
dojo.body().appendChild(tn); |
var ctr = 0; |
var nl = dojo.query("button", tn).connect("onclick", function(){ |
ctr++; |
}); |
nl[0].click(); |
doh.is(1, ctr); |
nl[0].click(); |
nl[0].click(); |
doh.is(3, ctr); |
} |
] |
); |
doh.run(); |
}); |
</script> |
</head> |
<body> |
<h1>testing dojo.NodeList</h1> |
<div id="sq100"> |
100px square, abs |
</div> |
<div id="t"> |
<span id="c1">c1</span> |
</div> |
</body> |
</html> |
/trunk/api/js/dojo1.0/dojo/tests/_base/json.js |
---|
New file |
0,0 → 1,31 |
if(!dojo._hasResource["tests._base.json"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base.json"] = true; |
dojo.provide("tests._base.json"); |
tests.register("tests._base.json", |
[ |
//Not testing dojo.toJson() on its own since Rhino will output the object properties in a different order. |
//Still valid json, but just in a different order than the source string. |
// take a json-compatible object, convert it to a json string, then put it back into json. |
function toAndFromJson(t){ |
var testObj = {a:"a", b:1, c:"c", d:"d", e:{e1:"e1", e2:2}, f:[1,2,3], g:"g",h:{h1:{h2:{h3:"h3"}}}}; |
var mirrorObj = dojo.fromJson(dojo.toJson(testObj)); |
t.assertEqual("a", mirrorObj.a); |
t.assertEqual(1, mirrorObj.b); |
t.assertEqual("c", mirrorObj.c); |
t.assertEqual("d", mirrorObj.d); |
t.assertEqual("e1", mirrorObj.e.e1); |
t.assertEqual(2, mirrorObj.e.e2); |
t.assertEqual(1, mirrorObj.f[0]); |
t.assertEqual(2, mirrorObj.f[1]); |
t.assertEqual(3, mirrorObj.f[2]); |
t.assertEqual("g", mirrorObj.g); |
t.assertEqual("h3", mirrorObj.h.h1.h2.h3); |
} |
] |
); |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/html_rtl.html |
---|
New file |
0,0 → 1,110 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
"http://www.w3.org/TR/html4/strict.dtd"> |
<html dir="rtl"> |
<head> |
<title>testing Core HTML/DOM/CSS/Style utils</title> |
<style type="text/css"> |
@import "../../resources/dojo.css"; |
</style> |
<script type="text/javascript" |
src="../../dojo.js" |
djConfig="isDebug: true"></script> |
<script type="text/javascript"> |
dojo.require("doh.runner"); |
dojo.addOnLoad(function(){ |
doh.register("t", |
[ |
function coordsWithVertScrollbar(t){ |
// show vertical scrollbar |
dojo.byId("rect_vert").style.display = ""; |
try{ |
t.is(100, dojo.coords('rect100').x); |
}finally{ |
dojo.byId("rect_vert").style.display = "none"; |
} |
}, |
function coordsWithHorzScrollbar(t){ |
// show horizonal scrollbar & scroll a bit left |
dojo.byId("rect_horz").style.display = ""; |
scrollBy(-50, 0); |
try{ |
t.is(100, dojo.coords('rect100', true).x); |
}finally{ |
dojo.byId("rect_horz").style.display = "none"; |
} |
}, |
function eventClientXY(t){ // IE only test |
if(dojo.isIE){ |
// show vertical scrollbar |
dojo.byId("rect_vert").style.display = ""; |
var rect = dojo.byId("rect100"); |
var assertException = null; |
function rect_onclick(e){ |
// move the rectangle to the mouse point |
rect.style.left = e.pageX + "px"; |
rect.style.top = e.pageY + "px"; |
window.alert("Do NOT move your mouse!!!\n\n" + |
"The black rectangle's top-left point should be under the mouse point.\n\n" + |
"If not, you will see a failure in the test report later.\n\n" + |
"Now press the space bar, but do NOT move your mouse."); |
rect.fireEvent('ondblclick'); |
} |
function rect_ondblclick(){ |
// test if the rectangle is really under the mouse point |
try{ |
t.is(0, event.offsetX); |
t.is(0, event.offsetY); |
}catch (e){ // allow the exception in a event handler go to the event firer |
assertException = e; |
} |
} |
dojo.connect(rect, "onclick", null, rect_onclick); |
dojo.connect(rect, "ondblclick", null, rect_ondblclick); |
window.alert("Move the mouse to anywhere in this page, and then press the space bar."); |
rect.fireEvent('onclick'); |
if(assertException != null){ |
throw assertException; |
} |
} |
} |
] |
); |
doh.run(); |
}); |
</script> |
<style type="text/css"> |
#rect100 { |
background-color: black; |
color: white; |
position: absolute; |
left: 100px; |
top: 100px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding: 0px; |
margin: 0px; |
overflow: hidden; |
} |
</style> |
</head> |
<body> |
<h1>testing Core HTML/DOM/CSS/Style utils</h1> |
<div id="rect100"> |
100px rect, abs, |
mouse point is at top-left after the test "eventClientXY" |
</div> |
<div id="rect_vert" style="height:1600px;display:none">show vertical scrollbar</div> |
<div id="rect_horz" style="width:1600px;display:none">show horizonal scrollbar</div> |
</body> |
</html> |
/trunk/api/js/dojo1.0/dojo/tests/_base/fx.js |
---|
New file |
0,0 → 1,8 |
if(!dojo._hasResource["tests._base.fx"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base.fx"] = true; |
dojo.provide("tests._base.fx"); |
if(dojo.isBrowser){ |
doh.registerUrl("tests._base.fx", dojo.moduleUrl("tests", "_base/fx.html"), 15000); |
} |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/Color.js |
---|
New file |
0,0 → 1,32 |
if(!dojo._hasResource["tests._base.Color"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base.Color"] = true; |
dojo.provide("tests._base.Color"); |
(function(){ |
var white = dojo.colorFromString("white").toRgba(); |
var maroon = dojo.colorFromString("maroon").toRgba(); |
var verifyColor = function(t, source, expected){ |
var color = new dojo.Color(source); |
t.is(expected, color.toRgba()); |
dojo.forEach(color.toRgba(), function(n){ t.is("number", typeof(n)); }); |
} |
doh.register("tests._base.Color", |
[ |
function testColor1(t){ verifyColor(t, "maroon", maroon); }, |
function testColor2(t){ verifyColor(t, "white", white); }, |
function testColor3(t){ verifyColor(t, "#fff", white); }, |
function testColor4(t){ verifyColor(t, "#ffffff", white); }, |
function testColor5(t){ verifyColor(t, "rgb(255,255,255)", white); }, |
function testColor6(t){ verifyColor(t, "#800000", maroon); }, |
function testColor7(t){ verifyColor(t, "rgb(128, 0, 0)", maroon); }, |
function testColor8(t){ verifyColor(t, "rgba(128, 0, 0, 0.5)", [128, 0, 0, 0.5]); }, |
function testColor9(t){ verifyColor(t, maroon, maroon); }, |
function testColor10(t){ verifyColor(t, [1, 2, 3], [1, 2, 3, 1]); }, |
function testColor11(t){ verifyColor(t, [1, 2, 3, 0.5], [1, 2, 3, 0.5]); }, |
function testColor12(t){ verifyColor(t, dojo.blendColors(new dojo.Color("black"), new dojo.Color("white"), 0.5), [128, 128, 128, 1]); } |
] |
); |
})(); |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/array.js |
---|
New file |
0,0 → 1,270 |
if(!dojo._hasResource["tests._base.array"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base.array"] = true; |
dojo.provide("tests._base.array"); |
tests.register("tests._base.array", |
[ |
function testIndexOf(t){ |
var foo = [128, 256, 512]; |
var bar = ["aaa", "bbb", "ccc"]; |
t.assertTrue(dojo.indexOf([45, 56, 85], 56) == 1); |
t.assertTrue(dojo.indexOf([Number, String, Date], String) == 1); |
t.assertTrue(dojo.indexOf(foo, foo[1]) == 1); |
t.assertTrue(dojo.indexOf(foo, foo[2]) == 2); |
t.assertTrue(dojo.indexOf(bar, bar[1]) == 1); |
t.assertTrue(dojo.indexOf(bar, bar[2]) == 2); |
foo.push(bar); |
t.assertTrue(dojo.indexOf(foo, bar) == 3); |
}, |
function testIndexOfFromIndex(t){ |
var foo = [128, 256, 512]; |
var bar = ["aaa", "bbb", "ccc"]; |
// FIXME: what happens w/ negative indexes? |
t.assertEqual(-1, dojo.indexOf([45, 56, 85], 56, 2)); |
t.assertEqual(1, dojo.indexOf([45, 56, 85], 56, 1)); |
}, |
function testLastIndexOf(t){ |
var foo = [128, 256, 512]; |
var bar = ["aaa", "bbb", "aaa", "ccc"]; |
t.assertTrue(dojo.indexOf([45, 56, 85], 56) == 1); |
t.assertTrue(dojo.indexOf([Number, String, Date], String) == 1); |
t.assertTrue(dojo.lastIndexOf(foo, foo[1]) == 1); |
t.assertTrue(dojo.lastIndexOf(foo, foo[2]) == 2); |
t.assertTrue(dojo.lastIndexOf(bar, bar[1]) == 1); |
t.assertTrue(dojo.lastIndexOf(bar, bar[2]) == 2); |
t.assertTrue(dojo.lastIndexOf(bar, bar[0]) == 2); |
}, |
function testLastIndexOfFromIndex(t){ |
// FIXME: what happens w/ negative indexes? |
t.assertEqual(1, dojo.lastIndexOf([45, 56, 85], 56, 1)); |
t.assertEqual(-1, dojo.lastIndexOf([45, 56, 85], 85, 1)); |
}, |
function testForEach(t){ |
var foo = [128, "bbb", 512]; |
dojo.forEach(foo, function(elt, idx, array){ |
switch(idx){ |
case 0: t.assertEqual(128, elt); break; |
case 1: t.assertEqual("bbb", elt); break; |
case 2: t.assertEqual(512, elt); break; |
default: t.assertTrue(false); |
} |
}); |
var noException = true; |
try{ |
dojo.forEach(undefined, function(){}); |
}catch(e){ |
noException = false; |
} |
t.assertTrue(noException); |
}, |
function testForEach_str(t){ |
var bar = 'abc'; |
dojo.forEach(bar, function(elt, idx, array){ |
switch(idx){ |
case 0: t.assertEqual("a", elt); break; |
case 1: t.assertEqual("b", elt); break; |
case 2: t.assertEqual("c", elt); break; |
default: t.assertTrue(false); |
} |
}); |
}, |
// FIXME: test forEach w/ a NodeList()? |
function testEvery(t){ |
var foo = [128, "bbb", 512]; |
t.assertTrue( |
dojo.every(foo, function(elt, idx, array){ |
t.assertEqual(Array, array.constructor); |
t.assertTrue(dojo.isArray(array)); |
t.assertTrue(typeof idx == "number"); |
if(idx == 1){ t.assertEqual("bbb" , elt); } |
return true; |
}) |
); |
t.assertTrue( |
dojo.every(foo, function(elt, idx, array){ |
switch(idx){ |
case 0: t.assertEqual(128, elt); return true; |
case 1: t.assertEqual("bbb", elt); return true; |
case 2: t.assertEqual(512, elt); return true; |
default: return false; |
} |
}) |
); |
t.assertFalse( |
dojo.every(foo, function(elt, idx, array){ |
switch(idx){ |
case 0: t.assertEqual(128, elt); return true; |
case 1: t.assertEqual("bbb", elt); return true; |
case 2: t.assertEqual(512, elt); return false; |
default: return true; |
} |
}) |
); |
}, |
function testEvery_str(t){ |
var bar = 'abc'; |
t.assertTrue( |
dojo.every(bar, function(elt, idx, array){ |
switch(idx){ |
case 0: t.assertEqual("a", elt); return true; |
case 1: t.assertEqual("b", elt); return true; |
case 2: t.assertEqual("c", elt); return true; |
default: return false; |
} |
}) |
); |
t.assertFalse( |
dojo.every(bar, function(elt, idx, array){ |
switch(idx){ |
case 0: t.assertEqual("a", elt); return true; |
case 1: t.assertEqual("b", elt); return true; |
case 2: t.assertEqual("c", elt); return false; |
default: return true; |
} |
}) |
); |
}, |
// FIXME: test NodeList for every()? |
function testSome(t){ |
var foo = [128, "bbb", 512]; |
t.assertTrue( |
dojo.some(foo, function(elt, idx, array){ |
t.assertEqual(3, array.length); |
return true; |
}) |
); |
t.assertTrue( |
dojo.some(foo, function(elt, idx, array){ |
if(idx < 1){ return true; } |
return false; |
}) |
); |
t.assertFalse( |
dojo.some(foo, function(elt, idx, array){ |
return false; |
}) |
); |
t.assertTrue( |
dojo.some(foo, function(elt, idx, array){ |
t.assertEqual(Array, array.constructor); |
t.assertTrue(dojo.isArray(array)); |
t.assertTrue(typeof idx == "number"); |
if(idx == 1){ t.assertEqual("bbb" , elt); } |
return true; |
}) |
); |
}, |
function testSome_str(t){ |
var bar = 'abc'; |
t.assertTrue( |
dojo.some(bar, function(elt, idx, array){ |
t.assertEqual(3, array.length); |
switch(idx){ |
case 0: t.assertEqual("a", elt); return true; |
case 1: t.assertEqual("b", elt); return true; |
case 2: t.assertEqual("c", elt); return true; |
default: return false; |
} |
}) |
); |
t.assertTrue( |
dojo.some(bar, function(elt, idx, array){ |
switch(idx){ |
case 0: t.assertEqual("a", elt); return true; |
case 1: t.assertEqual("b", elt); return true; |
case 2: t.assertEqual("c", elt); return false; |
default: return true; |
} |
}) |
); |
t.assertFalse( |
dojo.some(bar, function(elt, idx, array){ |
return false; |
}) |
); |
}, |
// FIXME: need to add scoping tests for all of these!!! |
function testFilter(t){ |
var foo = ["foo", "bar", 10]; |
t.assertEqual(["foo"], |
dojo.filter(foo, function(elt, idx, array){ |
return idx < 1; |
}) |
); |
t.assertEqual(["foo"], |
dojo.filter(foo, function(elt, idx, array){ |
return elt == "foo"; |
}) |
); |
t.assertEqual([], |
dojo.filter(foo, function(elt, idx, array){ |
return false; |
}) |
); |
t.assertEqual([10], |
dojo.filter(foo, function(elt, idx, array){ |
return typeof elt == "number"; |
}) |
); |
}, |
function testFilter_str(t){ |
var foo = "thinger blah blah blah"; |
t.assertEqual(["t", "h", "i"], |
dojo.filter(foo, function(elt, idx, array){ |
return idx < 3; |
}) |
); |
t.assertEqual([], |
dojo.filter(foo, function(elt, idx, array){ |
return false; |
}) |
); |
}, |
function testMap(t){ |
t.assertEqual([], |
dojo.map([], function(){ return true; }) |
); |
t.assertEqual([1, 2, 3], |
dojo.map(["cat", "dog", "mouse"], function(elt, idx, array){ |
return idx+1; |
}) |
); |
} |
] |
); |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/Deferred.js |
---|
New file |
0,0 → 1,68 |
if(!dojo._hasResource["tests._base.Deferred"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base.Deferred"] = true; |
dojo.provide("tests._base.Deferred"); |
doh.register("tests._base.Deferred", |
[ |
function callback(t){ |
var nd = new dojo.Deferred(); |
var cnt = 0; |
nd.addCallback(function(res){ |
doh.debug("debug from dojo.Deferred callback"); |
return res; |
}); |
nd.addCallback(function(res){ |
// t.debug("val:", res); |
cnt+=res; |
return cnt; |
}); |
nd.callback(5); |
// t.debug("cnt:", cnt); |
t.assertEqual(cnt, 5); |
}, |
function errback(t){ |
var nd = new dojo.Deferred(); |
var cnt = 0; |
nd.addErrback(function(val){ |
return ++cnt; |
}); |
nd.errback(); |
t.assertEqual(cnt, 1); |
}, |
function callbackTwice(t){ |
var nd = new dojo.Deferred(); |
var cnt = 0; |
nd.addCallback(function(res){ |
return ++cnt; |
}); |
nd.callback(); |
t.assertEqual(cnt, 1); |
var thrown = false; |
try{ |
nd.callback(); |
}catch(e){ |
thrown = true; |
} |
t.assertTrue(thrown); |
}, |
function addBoth(t){ |
var nd = new dojo.Deferred(); |
var cnt = 0; |
nd.addBoth(function(res){ |
return ++cnt; |
}); |
nd.callback(); |
t.assertEqual(cnt, 1); |
// nd.callback(); |
// t.debug(cnt); |
// t.assertEqual(cnt, 1); |
} |
] |
); |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/lang.js |
---|
New file |
0,0 → 1,180 |
if(!dojo._hasResource["tests._base.lang"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base.lang"] = true; |
dojo.provide("tests._base.lang"); |
tests.register("tests._base.lang", |
[ |
function mixin(t){ |
var src = { |
foo: function(){ |
t.debug("foo"); |
}, |
bar: "bar" |
}; |
var dest = {}; |
dojo.mixin(dest, src); |
t.assertEqual("function", typeof dest["foo"]); |
t.assertEqual("string", typeof dest["bar"]); |
}, |
function extend(t){ |
var src = { |
foo: function(){ |
t.debug("foo"); |
}, |
bar: "bar" |
}; |
function dest(){} |
dojo.extend(dest, src); |
var test = new dest(); |
t.assertEqual("function", typeof test["foo"]); |
t.assertEqual("string", typeof test["bar"]); |
}, |
function isObject(t){ |
t.assertFalse(dojo.isObject(true)); |
t.assertFalse(dojo.isObject(false)); |
t.assertFalse(dojo.isObject("foo")); |
t.assertTrue(dojo.isObject(new String("foo"))); |
t.assertTrue(dojo.isObject(null)); |
t.assertTrue(dojo.isObject({})); |
t.assertTrue(dojo.isObject([])); |
t.assertTrue(dojo.isObject(new Array())); |
}, |
function isArray(t){ |
t.assertTrue(dojo.isArray([])); |
t.assertTrue(dojo.isArray(new Array())); |
t.assertFalse(dojo.isArray({})); |
}, |
function isArrayLike(t){ |
t.assertFalse(dojo.isArrayLike("thinger")); |
t.assertTrue(dojo.isArrayLike(new Array())); |
t.assertFalse(dojo.isArrayLike({})); |
t.assertTrue(dojo.isArrayLike(arguments)); |
}, |
function isString(t){ |
t.assertFalse(dojo.isString(true)); |
t.assertFalse(dojo.isString(false)); |
t.assertTrue(dojo.isString("foo")); |
t.assertTrue(dojo.isString(new String("foo"))); |
t.assertFalse(dojo.isString(null)); |
t.assertFalse(dojo.isString({})); |
t.assertFalse(dojo.isString([])); |
}, |
function partial(t){ |
var scope = { foo: "bar" }; |
var scope2 = { foo: "baz" }; |
function thinger(arg1, arg2){ |
return [this.foo, arg1, arg2]; |
} |
var st1 = dojo.partial(thinger); |
t.assertEqual("bar", st1.call(scope)[0]); |
t.assertEqual(undefined, st1()[0]); |
var st2 = dojo.partial(thinger, "foo", "bar"); |
t.assertEqual("bar", st2()[2]); |
var st3 = dojo.partial(thinger, "foo", "bar"); |
}, |
function nestedPartial(t){ |
function thinger(arg1, arg2){ |
return [arg1, arg2]; |
} |
var st1 = dojo.partial(thinger, "foo"); |
t.assertEqual(undefined, st1()[1]); |
t.assertEqual("bar", st1("bar")[1]); |
// partials can accumulate |
var st2 = dojo.partial(st1, "thud"); |
t.assertEqual("foo", st2()[0]); |
t.assertEqual("thud", st2()[1]); |
}, |
function hitch(t){ |
var scope = { foo: "bar" }; |
var scope2 = { foo: "baz" }; |
function thinger(){ |
return [this.foo, arguments.length]; |
} |
var st1 = dojo.hitch(scope, thinger); |
t.assertEqual("bar", st1()[0]); |
t.assertEqual(0, st1()[1]); |
var st2 = dojo.hitch(scope2, thinger); |
t.assertEqual("baz", st2()[0]); |
t.assertEqual(0, st1()[1]); |
t.assertEqual(1, st1("blah")[1]); |
// st2 should be "scope proof" |
t.assertEqual("baz", st2.call(scope)[0]); |
}, |
function hitchWithArgs(t){ |
var scope = { foo: "bar" }; |
var scope2 = { foo: "baz" }; |
function thinger(){ |
return [this.foo, arguments.length]; |
} |
var st1 = dojo.hitch(scope, thinger, "foo", "bar"); |
t.assertEqual("bar", st1()[0]); |
t.assertEqual(2, st1()[1]); |
var st2 = dojo.hitch(scope2, thinger, "foo", "bar"); |
t.assertEqual("baz", st2()[0]); |
t.assertEqual(2, st2()[1]); |
}, |
function hitchAsPartial(t){ |
var scope = { foo: "bar" }; |
var scope2 = { foo: "baz" }; |
function thinger(arg1, arg2){ |
return [this.foo, arg1, arg2]; |
} |
var st1 = dojo.hitch(null, thinger); |
t.assertEqual("bar", st1.call(scope)[0]); |
t.assertEqual(undefined, st1()[0]); |
var st2 = dojo.hitch(null, thinger, "foo", "bar"); |
t.assertEqual("bar", st2()[2]); |
var st3 = dojo.hitch(null, thinger, "foo", "bar"); |
}, |
function _toArray(t){ |
var obj1 = [ 'foo', 'bar', 'spam', 'ham' ]; |
function thinger(){ |
return dojo._toArray(arguments); |
} |
var obj2 = thinger.apply(this, obj1); |
t.assertEqual(obj1[0], obj2[0]); |
}, |
function clone(t) { |
var obj1 = {foo: 'bar', answer: 42, jan102007: new Date(2007, 0, 10), |
baz: { |
a: null, |
b: [ |
1, "b", 2.3, true, false |
//, function(){ return 4; }, /\d+/gm |
] |
} |
}; |
var obj2 = dojo.clone(obj1); |
t.assertEqual(obj1.foo, obj2.foo); |
t.assertEqual(obj1.answer, obj2.answer); |
t.assertEqual(obj1.jan102007, obj2.jan102007); |
t.assertEqual(obj1.baz.a, obj2.baz.a); |
for(var i = 0; i < obj1.baz.b.length; ++i){ |
t.assertEqual(obj1.baz.b[i], obj2.baz.b[i]); |
} |
} |
] |
); |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/fx_delay.html |
---|
New file |
0,0 → 1,22 |
<html> |
<head> |
<style type="text/css"> |
#inner { width: 200px; height: 200px; background-color: #484} |
</style> |
<script type="text/javascript" src="../../dojo.js"></script> |
<script type="text/javascript"> |
dojo.require("dojo._base.fx"); |
dojo.require("dojo._base.html"); |
dojo.addOnLoad(function(){ |
var box = dojo.byId("box"); |
dojo.connect(box, "onclick", function(){ |
dojo.style(box, "opacity", "0"); |
dojo.fadeIn({node:box, delay:1}).play(); |
}); |
}); |
</script> |
</head> |
<body> |
<div id="box"><button id="inner">click me</button></div> |
</body> |
</html> |
/trunk/api/js/dojo1.0/dojo/tests/_base/xhrDummyMethod.php |
---|
New file |
0,0 → 1,7 |
<?php |
//Just a dummy end point to use in HTTP method calls like PUT and DELETE. |
//This avoids getting a 405 method not allowed calls for the tests that reference |
//this file. |
header("HTTP/1.1 200 OK"); |
?> |
/trunk/api/js/dojo1.0/dojo/tests/_base/xhr.html |
---|
New file |
0,0 → 1,387 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
"http://www.w3.org/TR/html4/strict.dtd"> |
<html> |
<head> |
<title>testing form and xhr utils</title> |
<style type="text/css"> |
@import "../../resources/dojo.css"; |
</style> |
<script type="text/javascript" |
src="../../dojo.js" djConfig="isDebug: true"></script> |
<script type="text/javascript"> |
dojo.require("doh.runner"); |
dojo.addOnLoad(function(){ |
var f1fo = { blah: "blah" }; |
var f1foStr = "blah=blah"; |
var f1foJson = '{"blah": "blah"}'; |
var f2fo = { |
blah: "blah", |
multi: [ |
"thud", |
"thonk" |
], |
textarea: "textarea_value" |
}; |
var f2foStr = "blah=blah&multi=thud&multi=thonk&textarea=textarea_value"; |
var f2foJson = '{"blah": "blah", "multi": ["thud", "thonk"], "textarea": "textarea_value"}'; |
var f3fo = { |
spaces: "string with spaces" |
}; |
var f3foStr = "spaces=string%20with%20spaces&"; |
var f3foJson = '{"spaces": "string with spaces"}'; |
doh.register("t", |
[ |
function formNodeToObject(t){ |
t.is(f1fo , dojo.formToObject(dojo.byId("f1"))); |
}, |
function formIdToObject(t){ |
t.is(f1fo , dojo.formToObject("f1")); |
}, |
function formToObjectWithMultiSelect(t){ |
t.is(f2fo , dojo.formToObject("f2")); |
}, |
function objectToQuery(t){ |
t.is(f1foStr , dojo.objectToQuery(f1fo)); |
}, |
function objectToQueryArr(t){ |
t.is(f2foStr, dojo.objectToQuery(f2fo)); |
}, |
function formToQuery(t){ |
t.is(f1foStr, dojo.formToQuery("f1")); |
}, |
function formToQueryArr(t){ |
t.is(f2foStr, dojo.formToQuery("f2")); |
}, |
function formToJson(t){ |
t.is(f1foJson, dojo.formToJson("f1")); |
}, |
function formToJsonArr(t){ |
t.is(f2foJson, dojo.formToJson("f2")); |
}, |
function queryToObject(t){ |
t.is(f1fo , dojo.queryToObject(f1foStr)); |
t.is(f2fo , dojo.queryToObject(f2foStr)); |
t.is(f3fo , dojo.queryToObject(f3foStr)); |
}, |
function textContentHandler(t){ |
t.is("foo bar baz ", |
dojo._contentHandlers.text({ |
responseText: "foo bar baz " |
}) |
); |
}, |
function jsonContentHandler(t){ |
var jsonObj = { |
foo: "bar", |
baz: [ |
{ thonk: "blarg" }, |
"xyzzy!" |
] |
}; |
t.is(jsonObj, |
dojo._contentHandlers.json({ |
responseText: dojo.toJson(jsonObj) |
}) |
); |
}, |
function jsonCFContentHandler(t){ |
var jsonObj = { |
foo: "bar", |
baz: [ |
{ thonk: "blarg" }, |
"xyzzy!" |
] |
}; |
var e; |
try{ |
dojo._contentHandlers["json-comment-filtered"]({ |
responseText: dojo.toJson(jsonObj) |
}) |
}catch(ex){ |
e = ex; |
}finally{ |
// did we fail closed? |
t.is((typeof e), "object"); |
} |
t.is(jsonObj, |
dojo._contentHandlers["json-comment-filtered"]({ |
responseText: "\tblag\n/*"+dojo.toJson(jsonObj)+"*/\n\r\t\r" |
}) |
); |
}, |
function jsContentHandler(t){ |
var jsonObj = { |
foo: "bar", |
baz: [ |
{ thonk: "blarg" }, |
"xyzzy!" |
] |
}; |
t.is(jsonObj, |
dojo._contentHandlers["javascript"]({ |
responseText: "("+dojo.toJson(jsonObj)+")" |
}) |
); |
t.t(dojo._contentHandlers["javascript"]({ |
responseText: "true;" |
}) |
); |
t.f(dojo._contentHandlers["javascript"]({ |
responseText: "false;" |
}) |
); |
}, |
function xmlContentHandler(t){ |
var fauxObj = { |
foo: "bar", |
baz: [ |
{ thonk: "blarg" }, |
"xyzzy!" |
] |
}; |
t.is(fauxObj, |
dojo._contentHandlers["xml"]({ responseXML: fauxObj }) |
); |
}, |
function xhrGet(t){ |
var d = new doh.Deferred(); |
var td = dojo.xhrGet({ |
url: "xhr.html", // self |
preventCache: true, |
load: function(text, ioArgs){ |
t.is(4, ioArgs.xhr.readyState); |
return text; //must return a value here or the parent test deferred fails. |
} |
}); |
t.t(td instanceof dojo.Deferred); |
td.addCallback(d, "callback"); |
return d; |
}, |
function xhrGet404(t){ |
var d = new doh.Deferred(); |
try{ |
var td = dojo.xhrGet({ |
url: "xhr_blarg.html", // doesn't exist |
error: function(err, ioArgs){ |
t.is(404, ioArgs.xhr.status); |
return err; //must return a value here or the parent test deferred fails. |
} |
}); |
// td.addErrback(d, "callback"); |
}catch(e){ |
d.callback(true); |
} |
// return d; |
}, |
function xhrGetContent(t){ |
var d = new doh.Deferred(); |
var td = dojo.xhrGet({ |
url: "xhr.html?color=blue", |
content: { |
foo: [ "bar", "baz" ], |
thud: "thonk", |
xyzzy: 3 |
} |
}); |
td.addCallback(function(text){ |
// console.debug(td, td.xhr, td.args); |
t.is("xhr.html?color=blue&foo=bar&foo=baz&thud=thonk&xyzzy=3", |
td.ioArgs.url); |
d.callback(true); |
}); |
return d; |
}, |
function xhrGetForm(t){ |
var d = new doh.Deferred(); |
var td = dojo.xhrGet({ |
url: "xhr.html", // self |
form: "f3" |
}); |
td.addCallback(function(xhr){ |
// console.debug(td.args.url); |
t.is("xhr.html?spaces=string%20with%20spaces", td.ioArgs.url); |
d.callback(true); |
}); |
return d; |
}, |
function xhrGetFormWithContent(t){ |
// ensure that stuff passed via content over-rides |
// what's specified in the form |
var d = new doh.Deferred(); |
var td = dojo.xhrGet({ |
url: "xhr.html", // self |
form: "f3", |
content: { spaces: "blah" } |
}); |
td.addCallback(function(xhr){ |
// console.debug(td.args.url); |
t.is("xhr.html?spaces=blah", td.ioArgs.url); |
d.callback(true); |
}); |
return d; |
}, |
function xhrPost(t){ |
var d = new doh.Deferred(); |
var td = dojo.xhrPost({ |
url: "xhr.html?foo=bar", // self |
content: { color: "blue"}, |
handle: function(res, ioArgs){ |
if((dojo._isDocumentOk(ioArgs.xhr))|| |
(ioArgs.xhr.status == 405) |
){ |
d.callback(true); |
}else{ |
d.errback(false); |
} |
} |
}); |
// t.t(td instanceof dojo.Deferred); |
return d; |
}, |
function xhrPostWithContent(t){ |
var d = new doh.Deferred(); |
var td = dojo.xhrPost({ |
url: "xhr.html", |
content: { |
foo: [ "bar", "baz" ], |
thud: "thonk", |
xyzzy: 3 |
} |
}); |
td.addBoth(function(text){ |
t.is("foo=bar&foo=baz&thud=thonk&xyzzy=3", |
td.ioArgs.query); |
if( (dojo._isDocumentOk(td.ioArgs.xhr))|| |
(td.ioArgs.xhr.status == 405) |
){ |
d.callback(true); |
}else{ |
d.errback(false); |
} |
}); |
return d; |
}, |
function xhrPostForm(t){ |
var d = new doh.Deferred(); |
var form = dojo.byId("f4"); |
//Make sure we can send a form to its |
//action URL. See trac: #2844. |
var td = dojo.xhrPost({ |
form: form |
}); |
td.addCallback(function(){ |
d.callback(true); |
}); |
td.addErrback(function(error){ |
d.callback(error); |
}); |
// t.t(td instanceof dojo.Deferred); |
return d; |
}, |
function rawXhrPost(t){ |
var d = new doh.Deferred(); |
var td = dojo.rawXhrPost({ |
url: "xhr.html", // self |
postContent: "foo=bar&color=blue&height=average", |
handle: function(res, ioArgs){ |
if((dojo._isDocumentOk(ioArgs.xhr))|| |
(ioArgs.xhr.status == 405) |
){ |
d.callback(true); |
}else{ |
d.errback(false); |
} |
} |
}); |
// t.t(td instanceof dojo.Deferred); |
return d; |
}, |
function xhrPut(t){ |
var d = new doh.Deferred(); |
var td = dojo.xhrPut({ |
url: "xhrDummyMethod.php?foo=bar", // self |
content: { color: "blue"}, |
handle: function(res, ioArgs){ |
if((dojo._isDocumentOk(ioArgs.xhr))|| |
(ioArgs.xhr.status == 403) |
){ |
d.callback(true); |
}else{ |
d.errback(false); |
} |
} |
}); |
// t.t(td instanceof dojo.Deferred); |
return d; |
}, |
function xhrDelete(t){ |
var d = new doh.Deferred(); |
var td = dojo.xhrDelete({ |
url: "xhrDummyMethod.php", // self |
preventCache: true, |
handle: function(res, ioArgs){ |
if((dojo._isDocumentOk(ioArgs.xhr))|| |
(ioArgs.xhr.status == 403) |
){ |
d.callback(true); |
}else{ |
d.errback(false); |
} |
} |
}); |
// t.t(td instanceof dojo.Deferred); |
return d; |
}, |
function xhrCancel(t){ |
var d = new doh.Deferred(); |
var td = dojo.xhrPost({ |
url: "xhrDummyMethod.php", // self |
handle: function(res, ioArgs){ |
if(res instanceof Error && res.dojoType == "cancel"){ |
d.callback(true); |
}else{ |
d.errback(false); |
} |
} |
}); |
td.cancel(); |
// t.t(td instanceof dojo.Deferred); |
return d; |
} |
// FIXME: need to add tests for wrapForm |
] |
); |
doh.run(); |
}); |
</script> |
</head> |
<body> |
<form id="f1" style="border: 1px solid black;"> |
<input type="text" name="blah" value="blah"> |
<input type="text" name="no_value" value="blah" disabled> |
<input type="button" name="no_value2" value="blah"> |
</form> |
<form id="f2" style="border: 1px solid black;"> |
<input type="text" name="blah" value="blah"> |
<input type="text" name="no_value" value="blah" disabled> |
<input type="button" name="no_value2" value="blah"> |
<select type="select" multiple name="multi" size="5"> |
<option value="blah">blah</option> |
<option value="thud" selected>thud</option> |
<option value="thonk" selected>thonk</option> |
</select> |
<textarea name="textarea">textarea_value</textarea> |
</form> |
<form id="f3" style="border: 1px solid black;"> |
<input type="hidden" name="spaces" value="string with spaces"> |
</form> |
<form id="f4" style="border: 1px solid black;" action="xhrDummyMethod.php"> |
<input type="hidden" name="action" value="Form with input named action"> |
</form> |
</body> |
</html> |
/trunk/api/js/dojo1.0/dojo/tests/_base/connect.js |
---|
New file |
0,0 → 1,225 |
if(!dojo._hasResource["tests._base.connect"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base.connect"] = true; |
dojo.provide("tests._base.connect"); |
hub = function(){ |
} |
failures = 0; |
bad = function(){ |
failures++; |
} |
good = function(){ |
} |
// make 'iterations' connections to hub |
// roughly half of which will be to 'good' and |
// half to 'bad' |
// all connections to 'bad' are disconnected |
// test can then be performed on the values |
// 'failures' and 'successes' |
markAndSweepTest = function(iterations){ |
var marked = []; |
// connections |
for(var i=0; i<iterations; i++){ |
if(Math.random() < 0.5){ |
marked.push(dojo.connect('hub', bad)); |
}else{ |
dojo.connect('hub', good); |
} |
} |
// Randomize markers (only if the count isn't very high) |
if(i < Math.pow(10, 4)){ |
var rm = [ ]; |
while(marked.length){ |
var m = Math.floor(Math.random() * marked.length); |
rm.push(marked[m]); |
marked.splice(m, 1); |
} |
marked = rm; |
} |
for(var m=0; m<marked.length; m++){ |
dojo.disconnect(marked[m]); |
} |
// test |
failures = 0; |
hub(); |
// return number of disconnected functions that fired (should be 0) |
return failures; |
} |
markAndSweepSubscribersTest = function(iterations){ |
var topic = "hubbins"; |
var marked = []; |
// connections |
for(var i=0; i<iterations; i++){ |
if(Math.random() < 0.5){ |
marked.push(dojo.subscribe(topic, bad)); |
}else{ |
dojo.subscribe(topic, good); |
} |
} |
// Randomize markers (only if the count isn't very high) |
if(i < Math.pow(10, 4)){ |
var rm = [ ]; |
while(marked.length){ |
var m = Math.floor(Math.random() * marked.length); |
rm.push(marked[m]); |
marked.splice(m, 1); |
} |
marked = rm; |
} |
for(var m=0; m<marked.length; m++){ |
dojo.unsubscribe(marked[m]); |
} |
// test |
failures = 0; |
dojo.publish(topic); |
// return number of unsubscribed functions that fired (should be 0) |
return failures; |
} |
tests.register("tests._base.connect", |
[ |
function smokeTest(t){ |
// foo sets ok to false |
var ok = false; |
var foo = { "foo": function(){ ok=false; } }; |
// connected function sets ok to true |
dojo.connect(foo, "foo", null, function(){ ok=true; }); |
foo.foo(); |
t.is(true, ok); |
}, |
function basicTest(t) { |
var out = ''; |
var obj = { |
foo: function() { |
out += 'foo'; |
}, |
bar: function() { |
out += 'bar'; |
}, |
baz: function() { |
out += 'baz'; |
} |
}; |
// |
var foobar = dojo.connect(obj, "foo", obj, "bar"); |
dojo.connect(obj, "bar", obj, "baz"); |
// |
out = ''; |
obj.foo(); |
t.is('foobarbaz', out); |
// |
out = ''; |
obj.bar(); |
t.is('barbaz', out); |
// |
out = ''; |
obj.baz(); |
t.is('baz', out); |
// |
dojo.connect(obj, "foo", obj, "baz"); |
dojo.disconnect(foobar); |
// |
out = ''; |
obj.foo(); |
t.is('foobaz', out); |
// |
out = ''; |
obj.bar(); |
t.is('barbaz', out); |
// |
out = ''; |
obj.baz(); |
t.is('baz', out); |
}, |
function hubConnectDisconnect1000(t){ |
t.is(0, markAndSweepTest(1000)); |
}, |
function args4Test(t){ |
// standard 4 args test |
var ok, obj = { foo: function(){ok=false;}, bar: function(){ok=true} }; |
dojo.connect(obj, "foo", obj, "bar"); |
obj.foo(); |
t.is(true, ok); |
}, |
function args3Test(t){ |
// make some globals |
var ok; |
dojo.global["gFoo"] = function(){ok=false;}; |
dojo.global["gOk"] = function(){ok=true;}; |
// 3 arg shorthand for globals (a) |
var link = dojo.connect("gFoo", null, "gOk"); |
gFoo(); |
dojo.disconnect(link); |
t.is(true, ok); |
// 3 arg shorthand for globals (b) |
link = dojo.connect(null, "gFoo", "gOk"); |
gFoo(); |
dojo.disconnect(link); |
t.is(true, ok); |
// verify disconnections |
gFoo(); |
t.is(false, ok); |
}, |
function args2Test(t){ |
// make some globals |
var ok; |
dojo.global["gFoo"] = function(){ok=false;}; |
dojo.global["gOk"] = function(){ok=true;}; |
// 2 arg shorthand for globals |
var link = dojo.connect("gFoo", "gOk"); |
gFoo(); |
dojo.disconnect(link); |
t.is(true, ok); |
// 2 arg shorthand for globals, alternate scoping |
link = dojo.connect("gFoo", gOk); |
gFoo(); |
dojo.disconnect(link); |
t.is(true, ok); |
}, |
function scopeTest1(t){ |
var foo = { ok: true, foo: function(){this.ok=false;} }; |
var bar = { ok: false, bar: function(){this.ok=true} }; |
// link foo.foo to bar.bar with natural scope |
var link = dojo.connect(foo, "foo", bar, "bar"); |
foo.foo(); |
t.is(false, foo.ok); |
t.is(true, bar.ok); |
}, |
function scopeTest2(t){ |
var foo = { ok: true, foo: function(){this.ok=false;} }; |
var bar = { ok: false, bar: function(){this.ok=true} }; |
// link foo.foo to bar.bar such that scope is always 'foo' |
var link = dojo.connect(foo, "foo", bar.bar); |
foo.foo(); |
t.is(true, foo.ok); |
t.is(false, bar.ok); |
}, |
function connectPublisher(t){ |
var foo = { inc: 0, foo: function(){ this.inc++; } }; |
var bar = { inc: 0, bar: function(){ this.inc++; } }; |
var c1h = dojo.connectPublisher("/blah", foo, "foo"); |
var c2h = dojo.connectPublisher("/blah", foo, "foo"); |
dojo.subscribe("/blah", bar, "bar"); |
foo.foo(); |
t.is(1, foo.inc); |
t.is(2, bar.inc); |
dojo.disconnect(c1h); |
foo.foo(); |
t.is(2, foo.inc); |
t.is(3, bar.inc); |
dojo.disconnect(c2h); |
foo.foo(); |
t.is(3, foo.inc); |
t.is(3, bar.inc); |
}, |
function publishSubscribe1000(t){ |
t.is(markAndSweepSubscribersTest(1000), 0); |
} |
] |
); |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/_loader/hostenv_spidermonkey.js |
---|
New file |
0,0 → 1,15 |
if(!dojo._hasResource["tests._base._loader.hostenv_spidermonkey"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base._loader.hostenv_spidermonkey"] = true; |
dojo.provide("tests._base._loader.hostenv_spidermonkey"); |
tests.register("tests._base._loader.hostenv_spidermonkey", |
[ |
function getText(t){ |
var filePath = dojo.moduleUrl("tests._base._loader", "getText.txt"); |
var text = readText(filePath); |
t.assertEqual("dojo._getText() test data", text); |
} |
] |
); |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/_loader/744/testEval.html |
---|
New file |
0,0 → 1,37 |
<html> |
<head> |
<script djConfig="isDebug: true" src="../../../../dojo.js"></script> |
<script> |
dojo.registerModulePath("foo", "tests/_base/_loader/744/foo"); |
dojo.require("foo.bar"); |
dojo.addOnLoad(function(){ |
console.debug(barMessage); |
console.debug(getBar2Message()); |
console.debug(getBarMessage()); |
}); |
dojo.addOnLoad(function(){ |
//This fails if window.execScripts is used for MSIE, since that function |
//does not return a value. |
var temp = "({name: 'light'})"; |
var evalTemp = dojo.eval(temp); |
console.debug("Object's name is: ", evalTemp.name); |
}); |
</script> |
</head> |
<body> |
<p> |
Defining global variables/functions in a module that is loaded via dojo.require() |
(meaning that XHR is used to load the text of the file and then eval the text) does |
not seem to define the global variables/functions on window. |
</p> |
<p> |
The test succeeds if you see "It Worked" 3 times in the debug console, then a "Object's name is: light" message. |
</p> |
</body> |
</html> |
/trunk/api/js/dojo1.0/dojo/tests/_base/_loader/744/foo/bar.js |
---|
New file |
0,0 → 1,20 |
if(!dojo._hasResource["foo.bar"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["foo.bar"] = true; |
dojo.provide("foo.bar"); |
//Define some globals and see if we can read them. |
//This is OK |
barMessage = "It Worked"; |
//This one FAILS in IE/Safari 2 with regular eval. |
function getBarMessage(){ |
return barMessage; |
} |
//This is OK |
getBar2Message = function(){ |
return getBarMessage(); |
} |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/_loader/addLoadEvents.html |
---|
New file |
0,0 → 1,28 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
"http://www.w3.org/TR/html4/strict.dtd"> |
<html> |
<head> |
<title>Testing dojo.addOnLoad() and dojo.addOnUnload()</title> |
<script type="text/javascript" |
src="../../../dojo.js" djConfig="isDebug: true"></script> |
<script type="text/javascript"> |
dojo.addOnLoad(function(){ |
alert("addOnLoad works"); |
}); |
dojo.addOnUnload(function(){ |
alert("addOnUnload works"); |
}); |
</script> |
</head> |
<body> |
<h1>Testing dojo.addOnLoad() and dojo.addOnUnload()</h1> |
<p>This page has registers a function with dojo.addOnLoad() and dojo.addOnUnload.</p> |
<p><b>dojo.addOnLoad()</b>: You should see an alert with the page first loads ("addOnLoad works").</p> |
<p><b>dojo.addOnUnload()</b>: You should see an alert if the page is reloaded, or if you navigate to a |
different web page ("addOnUnload works"). |
</body> |
</html> |
/trunk/api/js/dojo1.0/dojo/tests/_base/_loader/hostenv_rhino.js |
---|
New file |
0,0 → 1,17 |
if(!dojo._hasResource["tests._base._loader.hostenv_rhino"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base._loader.hostenv_rhino"] = true; |
dojo.provide("tests._base._loader.hostenv_rhino"); |
tests.register("tests._base._loader.hostenv_rhino", |
[ |
function getText(t){ |
var filePath = dojo.moduleUrl("tests._base._loader", "getText.txt"); |
var text = (new String(readText(filePath))); |
//The Java file read seems to add a line return. |
text = text.replace(/[\r\n]+$/, ""); |
t.assertEqual("dojo._getText() test data", text); |
} |
] |
); |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/_loader/loader.js |
---|
New file |
0,0 → 1,52 |
if(!dojo._hasResource["tests._base._loader.loader"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base._loader.loader"] = true; |
dojo.provide("tests._base._loader.loader"); |
tests.register("tests._base._loader.loader", |
[ |
function baseUrl(t){ |
var originalBaseUrl = djConfig["baseUrl"] || "./"; |
t.assertEqual(originalBaseUrl, dojo.baseUrl); |
}, |
function modulePaths(t){ |
dojo.registerModulePath("mycoolmod", "../some/path/mycoolpath"); |
dojo.registerModulePath("mycoolmod.widget", "http://some.domain.com/another/path/mycoolpath/widget"); |
t.assertEqual("../some/path/mycoolpath/util", dojo._getModuleSymbols("mycoolmod.util").join("/")); |
t.assertEqual("http://some.domain.com/another/path/mycoolpath/widget", dojo._getModuleSymbols("mycoolmod.widget").join("/")); |
t.assertEqual("http://some.domain.com/another/path/mycoolpath/widget/thingy", dojo._getModuleSymbols("mycoolmod.widget.thingy").join("/")); |
}, |
function moduleUrls(t){ |
dojo.registerModulePath("mycoolmod", "some/path/mycoolpath"); |
dojo.registerModulePath("mycoolmod2", "/some/path/mycoolpath2"); |
dojo.registerModulePath("mycoolmod.widget", "http://some.domain.com/another/path/mycoolpath/widget"); |
var basePrefix = dojo.baseUrl; |
//dojo._Uri will strip off "./" characters, so do the same here |
if(basePrefix == "./"){ |
basePrefix = ""; |
} |
t.assertEqual(basePrefix + "some/path/mycoolpath/my/favorite.html", |
dojo.moduleUrl("mycoolmod", "my/favorite.html").toString()); |
t.assertEqual(basePrefix + "some/path/mycoolpath/my/favorite.html", |
dojo.moduleUrl("mycoolmod.my", "favorite.html").toString()); |
t.assertEqual("/some/path/mycoolpath2/my/favorite.html", |
dojo.moduleUrl("mycoolmod2", "my/favorite.html").toString()); |
t.assertEqual("/some/path/mycoolpath2/my/favorite.html", |
dojo.moduleUrl("mycoolmod2.my", "favorite.html").toString()); |
t.assertEqual("http://some.domain.com/another/path/mycoolpath/widget/my/favorite.html", |
dojo.moduleUrl("mycoolmod.widget", "my/favorite.html").toString()); |
t.assertEqual("http://some.domain.com/another/path/mycoolpath/widget/my/favorite.html", |
dojo.moduleUrl("mycoolmod.widget.my", "favorite.html").toString()); |
} |
] |
); |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/_loader/getText.txt |
---|
New file |
0,0 → 1,0 |
dojo._getText() test data |
/trunk/api/js/dojo1.0/dojo/tests/_base/_loader/hostenv_browser.js |
---|
New file |
0,0 → 1,15 |
if(!dojo._hasResource["tests._base._loader.hostenv_browser"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base._loader.hostenv_browser"] = true; |
dojo.provide("tests._base._loader.hostenv_browser"); |
tests.register("tests._base._loader.hostenv_browser", |
[ |
function getText(t){ |
var filePath = dojo.moduleUrl("tests._base._loader", "getText.txt"); |
var text = dojo._getText(filePath); |
t.assertEqual("dojo._getText() test data", text); |
} |
] |
); |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/_loader/bootstrap.js |
---|
New file |
0,0 → 1,90 |
if(!dojo._hasResource["tests._base._loader.bootstrap"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base._loader.bootstrap"] = true; |
dojo.provide("tests._base._loader.bootstrap"); |
tests.register("tests._base._loader.bootstrap", |
[ |
function hasConsole(t){ |
t.assertTrue("console" in dojo.global); |
t.assertTrue("assert" in console); |
t.assertEqual("function", typeof console.assert); |
}, |
function hasDjConfig(t){ |
t.assertTrue("djConfig" in dojo.global); |
}, |
{ |
name: "getObject", |
setUp: function(){ |
//Set an object in global scope. |
dojo.global.globalValue = { |
color: "blue", |
size: 20 |
}; |
//Set up an object in a specific scope. |
this.foo = { |
bar: { |
color: "red", |
size: 100 |
} |
}; |
}, |
runTest: function(t){ |
//Test for existing object using global as root path. |
var globalVar = dojo.getObject("globalValue"); |
t.is("object", (typeof globalVar)); |
t.assertEqual("blue", globalVar.color); |
t.assertEqual(20, globalVar.size); |
t.assertEqual("blue", dojo.getObject("globalValue.color")); |
//Test for non-existent object using global as root path. |
//Then create it. |
t.assertFalse(dojo.getObject("something.thatisNew")); |
t.assertTrue(typeof(dojo.getObject("something.thatisNew", true)) == "object"); |
//Test for existing object using another object as root path. |
var scopedVar = dojo.getObject("foo.bar", false, this); |
t.assertTrue(typeof(scopedVar) == "object"); |
t.assertEqual("red", scopedVar.color); |
t.assertEqual(100, scopedVar.size); |
t.assertEqual("red", dojo.getObject("foo.bar.color", true, this)); |
//Test for existing object using another object as root path. |
//Then create it. |
t.assertFalse(dojo.getObject("something.thatisNew", false, this)); |
t.assertTrue(typeof(dojo.getObject("something.thatisNew", true, this)) == "object"); |
}, |
tearDown: function(){ |
//Clean up global object that should not exist if |
//the test is re-run. |
try{ |
delete dojo.global.something; |
delete this.something; |
}catch(e){} |
} |
}, |
{ |
name: "exists", |
setUp: function(){ |
this.foo = { |
bar: {} |
}; |
}, |
runTest: function(t){ |
t.assertTrue(dojo.exists("foo.bar", this)); |
t.assertFalse(dojo.exists("foo.bar")); |
} |
}, |
function evalWorks(t){ |
t.assertTrue(dojo.eval("(true)")); |
t.assertFalse(dojo.eval("(false)")); |
} |
] |
); |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/html_quirks.html |
---|
New file |
0,0 → 1,317 |
<html> |
<!-- |
we use a quirks-mode DTD on purpose to ensure that things go tilt. Wheee!! |
--> |
<head> |
<title>testing Core HTML/DOM/CSS/Style utils in quirks mode</title> |
<style type="text/css"> |
@import "../../resources/dojo.css"; |
</style> |
<script type="text/javascript" |
src="../../dojo.js" |
djConfig="isDebug: true"></script> |
<script type="text/javascript"> |
dojo.require("doh.runner"); |
dojo.addOnLoad(function(){ |
doh.register("t", |
[ |
"t.is(100, dojo.marginBox('sq100').w);", |
"t.is(100, dojo.marginBox('sq100').h);", |
"t.is(120, dojo.marginBox('sq100margin10').w);", |
"t.is(120, dojo.marginBox('sq100margin10').h);", |
"t.is(100, dojo.contentBox('sq100margin10').w);", |
"t.is(100, dojo.contentBox('sq100margin10').h);", |
// FIXME: the 'correct' w is not 100 on Safari WebKit (2.0.4 [419.3]), the right-margin extends to the document edge |
//"t.is(100, dojo.marginBox('sq100nopos').w);", |
"t.is(100, dojo.marginBox('sq100nopos').h);", |
function coordsBasic(t){ |
var pos = dojo.coords("sq100", false); |
// console.debug(pos); |
t.is(100, pos.x); |
t.is(100, pos.y); |
t.is(100, pos.w); |
t.is(100, pos.h); |
}, |
function coordsMargin(t){ |
// coords is getting us the margin-box location, is |
// this right? |
var pos = dojo.coords("sq100margin10", false); |
t.is(260, pos.x); |
t.is(110, pos.y); |
t.is(120, pos.w); |
t.is(120, pos.h); |
}, |
function sq100nopos(t){ |
var pos = dojo.coords("sq100nopos", false); |
// console.debug(pos); |
t.is(0, pos.x); |
t.t(pos.y > 0); |
// FIXME: the 'correct' w is not 100 on Safari WebKit (2.0.4 [419.3]), the right-margin extends to the document edge |
//t.is(100, pos.w); |
t.is(100, pos.h); |
} |
] |
); |
if(dojo.isIE){ |
// IE collapses padding in quirks mode. We just report on it. |
doh.register("t", |
[ |
"t.is(120, dojo.marginBox('sq100margin10pad10').w);", |
"t.is(120, dojo.marginBox('sq100margin10pad10').h);", |
"t.is(100, dojo.marginBox('sq100pad10').w);", |
"t.is(100, dojo.marginBox('sq100pad10').h);", |
"t.is(100, dojo.marginBox('sq100ltpad10').w);", |
"t.is(100, dojo.marginBox('sq100ltpad10').h);", |
"t.is(90, dojo.contentBox('sq100ltpad10').w);", |
"t.is(90, dojo.contentBox('sq100ltpad10').h);", |
"t.is(110, dojo.marginBox('sq100ltpad10rbmargin10').w);", |
"t.is(110, dojo.marginBox('sq100ltpad10rbmargin10').h);", |
"t.is(100, dojo.marginBox('sq100border10').w);", |
"t.is(100, dojo.marginBox('sq100border10').h);", |
"t.is(80, dojo.contentBox('sq100border10').w);", |
"t.is(80, dojo.contentBox('sq100border10').h);", |
"t.is(120, dojo.marginBox('sq100border10margin10').w);", |
"t.is(120, dojo.marginBox('sq100border10margin10').h);", |
"t.is(80, dojo.contentBox('sq100border10margin10').w);", |
"t.is(80, dojo.contentBox('sq100border10margin10').h);", |
"t.is(120, dojo.marginBox('sq100border10margin10pad10').w);", |
"t.is(120, dojo.marginBox('sq100border10margin10pad10').h);", |
"t.is(60, dojo.contentBox('sq100border10margin10pad10').w);", |
"t.is(60, dojo.contentBox('sq100border10margin10pad10').h);" |
] |
); |
}else{ |
doh.register("t", |
[ |
"t.is(140, dojo.marginBox('sq100margin10pad10').w);", |
"t.is(140, dojo.marginBox('sq100margin10pad10').h);", |
"t.is(120, dojo.marginBox('sq100pad10').w);", |
"t.is(120, dojo.marginBox('sq100pad10').h);", |
"t.is(110, dojo.marginBox('sq100ltpad10').w);", |
"t.is(110, dojo.marginBox('sq100ltpad10').h);", |
"t.is(100, dojo.contentBox('sq100ltpad10').w);", |
"t.is(100, dojo.contentBox('sq100ltpad10').h);", |
"t.is(120, dojo.marginBox('sq100ltpad10rbmargin10').w);", |
"t.is(120, dojo.marginBox('sq100ltpad10rbmargin10').h);", |
"t.is(120, dojo.marginBox('sq100border10').w);", |
"t.is(120, dojo.marginBox('sq100border10').h);", |
"t.is(100, dojo.contentBox('sq100border10').w);", |
"t.is(100, dojo.contentBox('sq100border10').h);", |
"t.is(140, dojo.marginBox('sq100border10margin10').w);", |
"t.is(140, dojo.marginBox('sq100border10margin10').h);", |
"t.is(100, dojo.contentBox('sq100border10margin10').w);", |
"t.is(100, dojo.contentBox('sq100border10margin10').h);", |
"t.is(160, dojo.marginBox('sq100border10margin10pad10').w);", |
"t.is(160, dojo.marginBox('sq100border10margin10pad10').h);", |
"t.is(100, dojo.contentBox('sq100border10margin10pad10').w);", |
"t.is(100, dojo.contentBox('sq100border10margin10pad10').h);" |
] |
); |
} |
doh.run(); |
}); |
</script> |
<style type="text/css"> |
html, body { |
padding: 0px; |
margin: 0px; |
border: 0px; |
} |
#sq100 { |
background-color: black; |
color: white; |
position: absolute; |
left: 100px; |
top: 100px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding: 0px; |
margin: 0px; |
overflow: hidden; |
} |
#sq100margin10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 250px; |
top: 100px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding: 0px; |
margin: 10px; |
overflow: hidden; |
} |
#sq100margin10pad10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 400px; |
top: 100px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding: 10px; |
margin: 10px; |
overflow: hidden; |
} |
#sq100pad10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 100px; |
top: 250px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding: 10px; |
margin: 0px; |
overflow: hidden; |
} |
#sq100ltpad10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 250px; |
top: 250px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding-left: 10px; |
padding-top: 10px; |
padding-right: 0px; |
padding-bottom: 0px; |
margin: 0px; |
overflow: hidden; |
} |
#sq100ltpad10rbmargin10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 400px; |
top: 250px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding-left: 10px; |
padding-top: 10px; |
padding-right: 0px; |
padding-bottom: 0px; |
margin-left: 0px; |
margin-top: 0px; |
margin-right: 10px; |
margin-bottom: 10px; |
overflow: hidden; |
} |
#sq100border10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 100px; |
top: 400px; |
width: 100px; |
height: 100px; |
border: 10px solid yellow; |
padding: 0px; |
margin: 0px; |
overflow: hidden; |
} |
#sq100border10margin10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 250px; |
top: 400px; |
width: 100px; |
height: 100px; |
border: 10px solid yellow; |
padding: 0px; |
margin: 10px; |
overflow: hidden; |
} |
#sq100border10margin10pad10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 400px; |
top: 400px; |
width: 100px; |
height: 100px; |
border: 10px solid yellow; |
padding: 10px; |
margin: 10px; |
overflow: hidden; |
} |
#sq100nopos { |
background-color: black; |
color: white; |
width: 100px; |
height: 100px; |
padding: 0px; |
margin: 0px; |
} |
</style> |
</head> |
<body> |
<h1>testing Core HTML/DOM/CSS/Style utils</h1> |
<div id="sq100"> |
100px square, abs |
</div> |
<div id="sq100margin10"> |
100px square, abs, 10px margin |
</div> |
<div id="sq100margin10pad10"> |
100px square, abs, 10px margin, 10px padding |
</div> |
<div id="sq100pad10"> |
100px square, abs, 10px padding |
</div> |
<div id="sq100ltpad10"> |
100px square, abs, 10px left and top padding |
</div> |
<div id="sq100ltpad10rbmargin10"> |
100px square, abs, 10px left and top padding, 10px bottom and right margin |
</div> |
<div id="sq100border10"> |
100px square, abs, 10px yellow border |
</div> |
<div id="sq100border10margin10"> |
100px square, abs, 10px yellow border, 10px margin |
</div> |
<div id="sq100border10margin10pad10"> |
100px square, abs, 10px yellow border, 10px margin, 10px padding |
</div> |
<div id="sq100nopos"> |
100px square, no positioning |
</div> |
</body> |
</html> |
/trunk/api/js/dojo1.0/dojo/tests/_base/html.html |
---|
New file |
0,0 → 1,391 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
"http://www.w3.org/TR/html4/strict.dtd"> |
<!-- |
we use a strict-mode DTD to ensure that the box model is the same for these |
basic tests |
--> |
<html> |
<head> |
<title>testing Core HTML/DOM/CSS/Style utils</title> |
<style type="text/css"> |
@import "../../resources/dojo.css"; |
</style> |
<script type="text/javascript" |
src="../../dojo.js" |
djConfig="isDebug: true"></script> |
<script type="text/javascript"> |
dojo.require("doh.runner"); |
function getIframeDocument(/*DOMNode*/iframeNode){ |
//summary: Returns the document object associated with the iframe DOM Node argument. |
var doc = iframeNode.contentDocument || // W3 |
( |
(iframeNode.contentWindow)&&(iframeNode.contentWindow.document) |
) || // IE |
( |
(iframeNode.name)&&(document.frames[iframeNode.name])&& |
(document.frames[iframeNode.name].document) |
) || null; |
return doc; |
} |
dojo.addOnLoad(function(){ |
doh.register("t", |
[ |
"t.is(100, dojo.marginBox('sq100').w);", |
"t.is(100, dojo.marginBox('sq100').h);", |
"t.is(120, dojo.marginBox('sq100margin10').w);", |
"t.is(120, dojo.marginBox('sq100margin10').h);", |
"t.is(100, dojo.contentBox('sq100margin10').w);", |
"t.is(100, dojo.contentBox('sq100margin10').h);", |
"t.is(140, dojo.marginBox('sq100margin10pad10').w);", |
"t.is(140, dojo.marginBox('sq100margin10pad10').h);", |
"t.is(120, dojo.marginBox('sq100pad10').w);", |
"t.is(120, dojo.marginBox('sq100pad10').h);", |
"t.is(110, dojo.marginBox('sq100ltpad10').w);", |
"t.is(110, dojo.marginBox('sq100ltpad10').h);", |
"t.is(100, dojo.contentBox('sq100ltpad10').w);", |
"t.is(100, dojo.contentBox('sq100ltpad10').h);", |
"t.is(120, dojo.marginBox('sq100ltpad10rbmargin10').w);", |
"t.is(120, dojo.marginBox('sq100ltpad10rbmargin10').h);", |
"t.is(120, dojo.marginBox('sq100border10').w);", |
"t.is(120, dojo.marginBox('sq100border10').h);", |
"t.is(100, dojo.contentBox('sq100border10').w);", |
"t.is(100, dojo.contentBox('sq100border10').h);", |
"t.is(140, dojo.marginBox('sq100border10margin10').w);", |
"t.is(140, dojo.marginBox('sq100border10margin10').h);", |
"t.is(100, dojo.contentBox('sq100border10margin10').w);", |
"t.is(100, dojo.contentBox('sq100border10margin10').h);", |
"t.is(160, dojo.marginBox('sq100border10margin10pad10').w);", |
"t.is(160, dojo.marginBox('sq100border10margin10pad10').h);", |
"t.is(100, dojo.contentBox('sq100border10margin10pad10').w);", |
"t.is(100, dojo.contentBox('sq100border10margin10pad10').h);", |
// FIXME: the 'correct' w is not 100 on Safari WebKit (2.0.4 [419.3]), the right-margin extends to the document edge |
// "t.is(100, dojo.marginBox('sq100nopos').w);", |
"t.is(100, dojo.marginBox('sq100nopos').h);", |
"t.is(10, dojo._getPadExtents(dojo.byId('sq100ltpad10rbmargin10')).l);", |
"t.is(10, dojo._getPadExtents(dojo.byId('sq100ltpad10rbmargin10')).t);", |
"t.is(10, dojo._getPadExtents(dojo.byId('sq100ltpad10rbmargin10')).w);", |
"t.is(10, dojo._getPadExtents(dojo.byId('sq100ltpad10rbmargin10')).h);", |
"t.is(0, dojo._getMarginExtents(dojo.byId('sq100ltpad10rbmargin10')).l);", |
"t.is(0, dojo._getMarginExtents(dojo.byId('sq100ltpad10rbmargin10')).t);", |
"t.is(10, dojo._getMarginExtents(dojo.byId('sq100ltpad10rbmargin10')).w);", |
"t.is(10, dojo._getMarginExtents(dojo.byId('sq100ltpad10rbmargin10')).h);", |
"t.is(10, dojo._getBorderExtents(dojo.byId('sq100border10margin10pad10')).l);", |
"t.is(10, dojo._getBorderExtents(dojo.byId('sq100border10margin10pad10')).t);", |
"t.is(20, dojo._getBorderExtents(dojo.byId('sq100border10margin10pad10')).w);", |
"t.is(20, dojo._getBorderExtents(dojo.byId('sq100border10margin10pad10')).h);", |
"t.is(20, dojo._getPadBorderExtents(dojo.byId('sq100border10margin10pad10')).l);", |
"t.is(20, dojo._getPadBorderExtents(dojo.byId('sq100border10margin10pad10')).t);", |
"t.is(40, dojo._getPadBorderExtents(dojo.byId('sq100border10margin10pad10')).w);", |
"t.is(40, dojo._getPadBorderExtents(dojo.byId('sq100border10margin10pad10')).h);", |
function coordsBasic(t){ |
var pos = dojo.coords("sq100", false); |
// console.debug(pos); |
t.is(100, pos.x); |
t.is(100, pos.y); |
t.is(100, pos.w); |
t.is(100, pos.h); |
}, |
function coordsMargin(t){ |
// coords is getting us the margin-box location, is |
// this right? |
var pos = dojo.coords("sq100margin10", false); |
t.is(260, pos.x); |
t.is(110, pos.y); |
t.is(120, pos.w); |
t.is(120, pos.h); |
}, |
function sq100nopos(t){ |
var pos = dojo.coords("sq100nopos", false); |
// console.debug(pos); |
t.is(0, pos.x); |
t.t(pos.y > 0); |
// FIXME: the 'correct' w is not 100 on Safari WebKit (2.0.4 [419.3]), the right-margin extends to the document edge |
// t.is(100, pos.w); |
t.is(100, pos.h); |
}, |
function coordsScrolled(t) { |
var s = document.createElement('div'); |
var c = document.createElement('div'); |
document.body.appendChild(s); |
s.appendChild(c); |
var x=257, y= 285; |
with (s.style) { |
position = 'absolute'; |
overflow = 'scroll'; |
} |
dojo._setMarginBox(s, x, y, 100, 100); |
dojo._setMarginBox(c, 0, 0, 500, 500); |
s.scrollTop = 200; |
var pos = dojo.coords(s, true); |
t.is(x, pos.x); |
t.is(y, pos.y); |
}, |
"t.is(1, dojo.style('sq100nopos', 'opacity'));", |
"t.is(0.1, dojo.style('sq100nopos', 'opacity', 0.1));", |
"t.is(0.8, dojo.style('sq100nopos', 'opacity', 0.8));", |
"t.is('static', dojo.style('sq100nopos', 'position'));", |
function getBgcolor(t){ |
var bgc = dojo.style('sq100nopos', 'backgroundColor'); |
t.t((bgc == "rgb(0, 0, 0)")||(bgc == "black")||(bgc == "#000000")); |
}, |
function isDescendant(t){ |
t.t(dojo.isDescendant("sq100", dojo.body())); |
t.t(dojo.isDescendant("sq100", dojo.doc)); |
t.t(dojo.isDescendant("sq100", "sq100")); |
t.t(dojo.isDescendant(dojo.byId("sq100"), "sq100")); |
t.f(dojo.isDescendant("sq100", dojo.byId("sq100").firstChild)); |
t.t(dojo.isDescendant(dojo.byId("sq100").firstChild, "sq100")); |
}, |
function isDescendantIframe(t){ |
var bif = dojo.byId("blah"); |
getIframeDocument(bif).write("<html><body><div id='subDiv'></div></body></html>"); |
getIframeDocument(bif).close(); |
// this test barely makes sense. disabling it for now. |
// t.t(dojo.isDescendant(bif.contentDocument.getElementById("subDiv"), bif.parentNode)); |
var subDiv = getIframeDocument(bif).getElementById("subDiv"); |
t.t(dojo.isDescendant(subDiv, subDiv)); |
t.t(dojo.isDescendant(subDiv, subDiv.parentNode)); |
t.f(dojo.isDescendant(subDiv.parentNode, subDiv)); |
}, |
function testClassFunctions(t){ |
var node = dojo.byId("sq100"); |
dojo.addClass(node, "a"); |
t.is("a", node.className); |
dojo.removeClass(node, "c"); |
t.is("a", node.className); |
t.assertTrue(dojo.hasClass(node, "a")); |
t.assertFalse(dojo.hasClass(node, "b")); |
dojo.addClass(node, "b"); |
t.is("a b", node.className); |
t.assertTrue(dojo.hasClass(node, "a")); |
t.assertTrue(dojo.hasClass(node, "b")); |
dojo.removeClass(node, "a"); |
t.is("b", node.className); |
t.assertFalse(dojo.hasClass(node, "a")); |
t.assertTrue(dojo.hasClass(node, "b")); |
dojo.toggleClass(node, "a"); |
t.is("b a", node.className); |
t.assertTrue(dojo.hasClass(node, "a")); |
t.assertTrue(dojo.hasClass(node, "b")); |
dojo.toggleClass(node, "a"); |
t.is("b", node.className); |
t.assertFalse(dojo.hasClass(node, "a")); |
t.assertTrue(dojo.hasClass(node, "b")); |
dojo.toggleClass(node, "b"); |
t.is("", node.className); |
t.assertFalse(dojo.hasClass(node, "a")); |
t.assertFalse(dojo.hasClass(node, "b")); |
dojo.removeClass(node, "c"); |
t.assertTrue(!node.className); |
} |
] |
); |
doh.run(); |
}); |
</script> |
<style type="text/css"> |
html, body { |
padding: 0px; |
margin: 0px; |
border: 0px; |
} |
#sq100 { |
background-color: black; |
color: white; |
position: absolute; |
left: 100px; |
top: 100px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding: 0px; |
margin: 0px; |
overflow: hidden; |
} |
#sq100margin10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 250px; |
top: 100px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding: 0px; |
margin: 10px; |
overflow: hidden; |
} |
#sq100margin10pad10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 400px; |
top: 100px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding: 10px; |
margin: 10px; |
overflow: hidden; |
} |
#sq100pad10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 100px; |
top: 250px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding: 10px; |
margin: 0px; |
overflow: hidden; |
} |
#sq100ltpad10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 250px; |
top: 250px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding-left: 10px; |
padding-top: 10px; |
padding-right: 0px; |
padding-bottom: 0px; |
margin: 0px; |
overflow: hidden; |
} |
#sq100ltpad10rbmargin10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 400px; |
top: 250px; |
width: 100px; |
height: 100px; |
border: 0px; |
padding-left: 10px; |
padding-top: 10px; |
padding-right: 0px; |
padding-bottom: 0px; |
margin-left: 0px; |
margin-top: 0px; |
margin-right: 10px; |
margin-bottom: 10px; |
overflow: hidden; |
} |
#sq100border10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 100px; |
top: 400px; |
width: 100px; |
height: 100px; |
border: 10px solid yellow; |
padding: 0px; |
margin: 0px; |
overflow: hidden; |
} |
#sq100border10margin10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 250px; |
top: 400px; |
width: 100px; |
height: 100px; |
border: 10px solid yellow; |
padding: 0px; |
margin: 10px; |
overflow: hidden; |
} |
#sq100border10margin10pad10 { |
background-color: black; |
color: white; |
position: absolute; |
left: 400px; |
top: 400px; |
width: 100px; |
height: 100px; |
border: 10px solid yellow; |
padding: 10px; |
margin: 10px; |
overflow: hidden; |
} |
#sq100nopos { |
background-color: black; |
color: white; |
width: 100px; |
height: 100px; |
padding: 0px; |
margin: 0px; |
} |
</style> |
</head> |
<body> |
<h1>testing Core HTML/DOM/CSS/Style utils</h1> |
<div id="sq100"> |
100px square, abs |
</div> |
<div id="sq100margin10"> |
100px square, abs, 10px margin |
</div> |
<div id="sq100margin10pad10"> |
100px square, abs, 10px margin, 10px padding |
</div> |
<div id="sq100pad10"> |
100px square, abs, 10px padding |
</div> |
<div id="sq100ltpad10"> |
100px square, abs, 10px left and top padding |
</div> |
<div id="sq100ltpad10rbmargin10"> |
100px square, abs, 10px left and top padding, 10px bottom and right margin |
</div> |
<div id="sq100border10"> |
100px square, abs, 10px yellow border |
</div> |
<div id="sq100border10margin10"> |
100px square, abs, 10px yellow border, 10px margin |
</div> |
<div id="sq100border10margin10pad10"> |
100px square, abs, 10px yellow border, 10px margin, 10px padding |
</div> |
<div id="sq100nopos"> |
100px square, no positioning |
</div> |
<iframe id="blah"></iframe> |
</body> |
</html> |
/trunk/api/js/dojo1.0/dojo/tests/_base/query.html |
---|
New file |
0,0 → 1,135 |
<html> |
<head> |
<title>testing dojo.query()</title> |
<style type="text/css"> |
@import "../../resources/dojo.css"; |
</style> |
<script type="text/javascript" src="../../dojo.js" |
djConfig="isDebug: true, debugAtAllCosts: true, noFirebugLite: true"></script> |
<script type="text/javascript" src="../../../util/doh/runner.js"></script> |
<script type="text/javascript"> |
dojo.require("doh.runner"); |
dojo.addOnLoad(function(){ |
doh.register("t", |
[ |
"doh.is(4, (dojo.query('h3')).length);", |
"doh.is(1, (dojo.query('h1:first-child')).length);", |
"doh.is(2, (dojo.query('h3:first-child')).length);", |
"doh.is(1, (dojo.query('#t')).length);", |
"doh.is(1, (dojo.query('#bug')).length);", |
"doh.is(4, (dojo.query('#t h3')).length);", |
"doh.is(1, (dojo.query('div#t')).length);", |
"doh.is(4, (dojo.query('div#t h3')).length);", |
"doh.is(0, (dojo.query('span#t')).length);", |
"doh.is(1, (dojo.query('#t div > h3')).length);", |
"doh.is(2, (dojo.query('.foo')).length);", |
"doh.is(1, (dojo.query('.foo.bar')).length);", |
"doh.is(2, (dojo.query('.baz')).length);", |
"doh.is(3, (dojo.query('#t > h3')).length);", |
"doh.is(12, (dojo.query('#t > *')).length);", |
"doh.is(12, (dojo.query('#t >')).length);", |
"doh.is(3, (dojo.query('.foo >')).length);", |
"doh.is(3, (dojo.query('.foo > *')).length);", |
"doh.is(3, (dojo.query('> *', 'container')).length);", |
"doh.is(3, (dojo.query('> h3', 't')).length);", |
"doh.is(2, (dojo.query('.foo, .bar')).length);", |
"doh.is(2, (dojo.query('.foo,.bar')).length);", |
"doh.is(1, (dojo.query('.foo.bar')).length);", |
"doh.is(2, (dojo.query('.foo')).length);", |
"doh.is(2, (dojo.query('.baz')).length);", |
"doh.is(1, (dojo.query('span.baz')).length);", |
"doh.is(1, (dojo.query('sPaN.baz')).length);", |
"doh.is(1, (dojo.query('SPAN.baz')).length);", |
// FIXME: need to support [foo="foo bar"]. We're incorrectly tokenizing! |
"doh.is(2, (dojo.query('[foo~=\"bar\"]')).length);", |
"doh.is(2, (dojo.query('[ foo ~= \"bar\" ]')).length);", |
// "t.is(0, (dojo.query('[ foo ~= \"\\'bar\\'\" ]')).length);", |
"doh.is(3, (dojo.query('[foo]')).length);", |
"doh.is(1, (dojo.query('[foo$=\"thud\"]')).length);", |
"doh.is(1, (dojo.query('[foo$=thud]')).length);", |
"doh.is(1, (dojo.query('[foo$=\"thudish\"]')).length);", |
"doh.is(1, (dojo.query('#t [foo$=thud]')).length);", |
"doh.is(1, (dojo.query('#t [ title $= thud ]')).length);", |
"doh.is(0, (dojo.query('#t span[ title $= thud ]')).length);", |
"doh.is(1, (dojo.query('[foo|=\"bar\"]')).length);", |
"doh.is(1, (dojo.query('[foo|=\"bar-baz\"]')).length);", |
"doh.is(0, (dojo.query('[foo|=\"baz\"]')).length);", |
"doh.is(dojo.byId('_foo'), dojo.query('.foo:nth-child(2)')[0]);", |
"doh.is(dojo.query('style')[0], dojo.query(':nth-child(2)')[0]);", |
"doh.is(3, dojo.query('>', 'container').length);", |
"doh.is(3, dojo.query('> *', 'container').length);", |
"doh.is(2, dojo.query('> [qux]', 'container').length);", |
"doh.is('child1', dojo.query('> [qux]', 'container')[0].id);", |
"doh.is('child3', dojo.query('> [qux]', 'container')[1].id);", |
"doh.is(3, dojo.query('>', 'container').length);", |
"doh.is(3, dojo.query('> *', 'container').length);", |
"doh.is('passed', dojo.query('#bug')[0].value);", |
"doh.is(1, dojo.query('#t span.foo:not(span:first-child)').length);", |
"doh.is(1, dojo.query('#t span.foo:not(:first-child)').length);", |
"doh.is(2, dojo.query('#t > h3:nth-child(odd)').length);", |
"doh.is(3, dojo.query('#t h3:nth-child(odd)').length);", |
"doh.is(3, dojo.query('#t h3:nth-child(2n+1)').length);", |
"doh.is(1, dojo.query('#t h3:nth-child(even)').length);", |
"doh.is(1, dojo.query('#t h3:nth-child(2n)').length);", |
"doh.is(0, dojo.query('#t h3:nth-child(2n+3)').length);", |
"doh.is(2, dojo.query('#t h3:nth-child(1)').length);", |
"doh.is(1, dojo.query('#t > h3:nth-child(1)').length);", |
"doh.is(3, dojo.query('#t :nth-child(3)').length);", |
"doh.is(0, dojo.query('#t > div:nth-child(1)').length);", |
"doh.is(7, dojo.query('#t span').length);", |
"doh.is(4, dojo.query('#t > span:empty').length);", |
"doh.is(6, dojo.query('#t span:empty').length);", |
"doh.is(0, dojo.query('h3 span:empty').length);", |
"doh.is(1, dojo.query('h3 :not(:empty)').length);", |
function silly_IDs1(){ |
doh.t(document.getElementById("silly:id::with:colons")); |
doh.is(1, dojo.query("#silly\\:id\\:\\:with\\:colons").length); |
}, |
function NodeList_identity(){ |
var foo = new dojo.NodeList([dojo.byId("container")]); |
doh.is(foo, dojo.query(foo)); |
}, |
function xml(){ |
try{ |
dojo.require("dojox.data.dom"); |
var doc = dojox.data.dom.createDocument("<ResultSet><Result>One</Result><Result>Two</Result></ResultSet>"); |
console.debug(doc); |
console.debug(doc.documentElement); |
console.debug(dojo.query("Result", doc.documentElement)); |
}catch(e){ console.debug(e); } |
} |
] |
); |
doh.run(); |
}); |
</script> |
</head> |
<body> |
<h1>testing dojo.query()</h1> |
<div id="t"> |
<h3>h3 <span>span</span> endh3 </h3> |
<!-- comment to throw things off --> |
<div class="foo bar" id="_foo"> |
<h3>h3</h3> |
<span id="foo"></span> |
<span></span> |
</div> |
<h3>h3</h3> |
<h3 class="baz" title="thud">h3</h3> |
<span class="foobar baz foo"></span> |
<span foo="bar"></span> |
<span foo="baz bar thud"></span> |
<!-- FIXME: should foo="bar-baz-thud" match? [foo$=thud] ??? --> |
<span foo="bar-baz-thudish" id="silly:id::with:colons"></span> |
<div id="container"> |
<div id="child1" qux="true"></div> |
<div id="child2"></div> |
<div id="child3" qux="true"></div> |
</div> |
<div qux="true"></div> |
<input id="notbug" name="bug" type="hidden" value="failed" /> |
<input id="bug" type="hidden" value="passed" /> |
</div> |
</body> |
</html> |
/trunk/api/js/dojo1.0/dojo/tests/_base/declare.js |
---|
New file |
0,0 → 1,197 |
if(!dojo._hasResource["tests._base.declare"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base.declare"] = true; |
dojo.provide("tests._base.declare"); |
tests.register("tests._base.declare", |
[ |
function smokeTest(t){ |
dojo.declare("tests._base.declare.tmp"); |
var tmp = new tests._base.declare.tmp(); |
dojo.declare("testsFoo"); |
var tmp = new testsFoo(); |
}, |
function smokeTest2(t){ |
dojo.declare("tests._base.declare.foo", null, { |
foo: "thonk" |
}); |
var tmp = new tests._base.declare.foo(); |
t.is("thonk", tmp.foo); |
dojo.declare("testsFoo2", null, { |
foo: "thonk" |
}); |
var tmp2 = new testsFoo2(); |
t.is("thonk", tmp2.foo); |
}, |
function smokeTestWithCtor(t){ |
dojo.declare("tests._base.declare.fooBar", null, { |
constructor: function(){ |
this.foo = "blah"; |
}, |
foo: "thonk" |
}); |
var tmp = new tests._base.declare.fooBar(); |
t.is("blah", tmp.foo); |
}, |
function smokeTestCompactArgs(t){ |
dojo.declare("tests._base.declare.fooBar2", null, { |
foo: "thonk" |
}); |
var tmp = new tests._base.declare.fooBar2(); |
t.is("thonk", tmp.foo); |
}, |
function subclass(t){ |
dojo.declare("tests._base.declare.tmp3", null, { |
foo: "thonk" |
}); |
dojo.declare("tests._base.declare.tmp4", tests._base.declare.tmp3); |
var tmp = new tests._base.declare.tmp4(); |
t.is("thonk", tmp.foo); |
}, |
function subclassWithCtor(t){ |
dojo.declare("tests._base.declare.tmp5", null, { |
constructor: function(){ |
this.foo = "blah"; |
}, |
foo: "thonk" |
}); |
dojo.declare("tests._base.declare.tmp6", tests._base.declare.tmp5); |
var tmp = new tests._base.declare.tmp6(); |
t.is("blah", tmp.foo); |
}, |
function mixinSubclass(t){ |
dojo.declare("tests._base.declare.tmp7", null, { |
foo: "thonk" |
}); |
dojo.declare("tests._base.declare.tmp8", null, { |
constructor: function(){ |
this.foo = "blah"; |
} |
}); |
var tmp = new tests._base.declare.tmp8(); |
t.is("blah", tmp.foo); |
dojo.declare("tests._base.declare.tmp9", |
[ |
tests._base.declare.tmp7, // prototypal |
tests._base.declare.tmp8 // mixin |
]); |
var tmp2 = new tests._base.declare.tmp9(); |
t.is("blah", tmp2.foo); |
}, |
function superclassRef(t){ |
dojo.declare("tests._base.declare.tmp10", null, { |
foo: "thonk" |
}); |
dojo.declare("tests._base.declare.tmp11", tests._base.declare.tmp10, { |
constructor: function(){ |
this.foo = "blah"; |
} |
}); |
var tmp = new tests._base.declare.tmp11(); |
t.is("blah", tmp.foo); |
t.is("thonk", tests._base.declare.tmp11.superclass.foo); |
}, |
function inheritedCall(t){ |
var foo = "xyzzy"; |
dojo.declare("tests._base.declare.tmp12", null, { |
foo: "thonk", |
bar: function(arg1, arg2){ |
if(arg1){ |
this.foo = arg1; |
} |
if(arg2){ |
foo = arg2; |
} |
} |
}); |
dojo.declare("tests._base.declare.tmp13", tests._base.declare.tmp12, { |
constructor: function(){ |
this.foo = "blah"; |
} |
}); |
var tmp = new tests._base.declare.tmp13(); |
t.is("blah", tmp.foo); |
t.is("xyzzy", foo); |
tmp.bar("zot"); |
t.is("zot", tmp.foo); |
t.is("xyzzy", foo); |
tmp.bar("trousers", "squiggle"); |
t.is("trousers", tmp.foo); |
t.is("squiggle", foo); |
}, |
function inheritedExplicitCall(t){ |
var foo = "xyzzy"; |
dojo.declare("tests._base.declare.tmp14", null, { |
foo: "thonk", |
bar: function(arg1, arg2){ |
if(arg1){ |
this.foo = arg1; |
} |
if(arg2){ |
foo = arg2; |
} |
} |
}); |
dojo.declare("tests._base.declare.tmp15", tests._base.declare.tmp14, { |
constructor: function(){ |
this.foo = "blah"; |
}, |
bar: function(arg1, arg2){ |
this.inherited("bar", arguments, [arg2, arg1]); |
}, |
baz: function(arg1, arg2){ |
tests._base.declare.tmp15.superclass.bar.apply(this, arguments); |
} |
}); |
var tmp = new tests._base.declare.tmp15(); |
t.is("blah", tmp.foo); |
t.is("xyzzy", foo); |
tmp.baz("zot"); |
t.is("zot", tmp.foo); |
t.is("xyzzy", foo); |
tmp.bar("trousers", "squiggle"); |
t.is("squiggle", tmp.foo); |
t.is("trousers", foo); |
}, |
function inheritedMixinCalls(t){ |
dojo.declare("tests._base.declare.tmp16", null, { |
foo: "", |
bar: function(){ |
this.foo += "tmp16"; |
} |
}); |
dojo.declare("tests._base.declare.mixin16", null, { |
bar: function(){ |
this.inherited(arguments); |
this.foo += ".mixin16"; |
} |
}); |
dojo.declare("tests._base.declare.mixin17", tests._base.declare.mixin16, { |
bar: function(){ |
this.inherited(arguments); |
this.foo += ".mixin17"; |
} |
}); |
dojo.declare("tests._base.declare.tmp17", [tests._base.declare.tmp16, tests._base.declare.mixin17], { |
bar: function(){ |
this.inherited(arguments); |
this.foo += ".tmp17"; |
} |
}); |
var tmp = new tests._base.declare.tmp17(); |
tmp.bar(); |
t.is("tmp16.mixin16.mixin17.tmp17", tmp.foo); |
}, |
function mixinPreamble(t){ |
var passed = false; |
dojo.declare("tests._base.declare.tmp16"); |
new tests._base.declare.tmp16({ preamble: function(){ passed = true; } }); |
t.t(passed); |
} |
// FIXME: there are still some permutations to test like: |
// - ctor arguments |
// - multi-level inheritance + L/R conflict checks |
] |
); |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/xhr.js |
---|
New file |
0,0 → 1,8 |
if(!dojo._hasResource["tests._base.xhr"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base.xhr"] = true; |
dojo.provide("tests._base.xhr"); |
if(dojo.isBrowser){ |
doh.registerUrl("tests._base.xhr", dojo.moduleUrl("tests", "_base/xhr.html")); |
} |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/timeout.php |
---|
New file |
0,0 → 1,7 |
<?php |
$callbackName = $_REQUEST["callback"]; |
sleep(5); |
print "SuperXFooBarVariable = 'Oh no! SuperXFooBarVariable is defined (should not be for timeout case).'; {$callbackName}({Status: 'good'});"; |
?> |
/trunk/api/js/dojo1.0/dojo/tests/_base/html_box_quirks.html |
---|
New file |
0,0 → 1,205 |
<!-- |
we use a quirks-mode DTD to check for quirks! |
--> |
<html> |
<head> |
<title> test html.js Box utils</title> |
<style type="text/css"> |
/*@import "../../resources/dojo.css";*/ |
</style> |
<script type="text/javascript" |
src="../../dojo.js" |
djConfig="isDebug: true"></script> |
<script type="text/javascript"> |
dojo.require("doh.runner"); |
var margin = '1px'; |
var border = '3px solid black'; |
var padding = '5px'; |
var defaultStyles = { |
height: '100px', |
width: '100px', |
position: 'absolute', |
backgroundColor: 'red' |
}; |
var defaultChildStyles = { |
height: '20px', |
width: '20px', |
backgroundColor: 'blue' |
} |
var testStyles = [ |
{}, |
{margin: margin}, |
{border: border}, |
{padding: padding}, |
{margin: margin, border: border}, |
{margin: margin, padding: padding}, |
{border: border, padding: padding}, |
{margin: margin, border: border, padding: padding} |
] |
function sameBox(inBox1, inBox2) { |
for (var i in inBox1) |
if (inBox1[i] != inBox2[i]) { |
console.log((arguments[2]||'box1') + '.' + i + ': ', inBox1[i], ' != ', (arguments[3]||'box2') + '.' + i + ': ', inBox2[i]); |
return false; |
} |
return true; |
} |
function reciprocalMarginBoxTest(inNode, inBox) { |
var s = inBox || dojo.marginBox(inNode); |
dojo.marginBox(inNode, s); |
var e = dojo.marginBox(inNode); |
return sameBox(s, e); |
} |
function fitTest(inParent, inChild) { |
var pcb = dojo.contentBox(inParent); |
return reciprocalMarginBoxTest(inChild, pcb); |
} |
function createStyledElement(inStyle, inParent, inElement, inNoDefault) { |
inStyle = inStyle||{}; |
if (!inNoDefault) { |
for (var i in defaultStyles) |
if (!inStyle[i]) |
inStyle[i] = defaultStyles[i]; |
} |
var n = document.createElement(inElement || 'div'); |
(inParent||document.body).appendChild(n); |
dojo.mixin(n.style, inStyle); |
return n; |
} |
var _testTopInc = 0; |
var _testTop = 150; |
var _testInitTop = 250; |
function styleIncTop(inStyle) { |
inStyle = dojo.mixin({}, inStyle||{}); |
inStyle.top = (_testInitTop + _testTop*_testTopInc) + 'px'; |
_testTopInc++; |
return inStyle; |
} |
function removeTestNode(inNode) { |
// leave nodes for inspection or don't return to delete them |
return; |
inNode = dojo.byId(inNode); |
inNode.parentNode.removeChild(inNode); |
_testTopInc--; |
} |
function testAndCallback(inTest, inAssert, inComment, inOk, inErr) { |
inTest.assertTrue('/* ' + inComment + '*/' + inAssert); |
if (inAssert) |
inOk&&inOk(); |
else |
inErr&&inErr(); |
} |
// args are (styles, parent, element name, no default) |
function mixCreateElementArgs(inMix, inArgs) { |
args = [{}]; |
if (inArgs&&inArgs[0]) |
dojo.mixin(args[0], inArgs[0]); |
if (inMix.length) |
dojo.mixin(args[0], inMix[0]||{}); |
// parent comes from source |
if (inMix.length > 1) |
args[1] = inMix[1]; |
args[2] = inArgs[2]; |
args[3] = inArgs[3] |
return args; |
}; |
function createStyledNodes(inArgs, inFunc) { |
for (var i=0, n; (s=testStyles[i]); i++) { |
n = createStyledElement.apply(this, mixCreateElementArgs([styleIncTop(s)], inArgs)); |
inFunc&&inFunc(n); |
} |
} |
function createStyledParentChild(inParentArgs, inChildArgs, inFunc) { |
for (var i=0, s, p, c; (s=testStyles[i]); i++) { |
p = createStyledElement.apply(this, mixCreateElementArgs([styleIncTop(s)], inParentArgs)); |
c = createStyledElement.apply(this, mixCreateElementArgs([{}, p], inChildArgs)); |
inFunc&&inFunc(p, c); |
} |
} |
function createStyledParentChildren(inParentArgs, inChildArgs, inFunc) { |
for (var i=0, s, p; (s=testStyles[i]); i++) |
for (var j=0, sc, c, props; (sc=testStyles[j]); j++) { |
p = createStyledElement.apply(this, mixCreateElementArgs([styleIncTop(s)], inParentArgs)); |
c = createStyledElement.apply(this, mixCreateElementArgs([sc, p], inChildArgs)); |
inFunc&&inFunc(p, c); |
} |
for (var i=0, s, p, c; (s=testStyles[i]); i++) { |
p = createStyledElement.apply(this, mixCreateElementArgs([styleIncTop(s)], inParentArgs)); |
c = createStyledElement.apply(this, mixCreateElementArgs([{}, p], inChildArgs)); |
inFunc&&inFunc(p, c); |
} |
} |
function runFitTest(inTest, inParentStyles, inChildStyles) { |
createStyledParentChildren([inParentStyles], [inChildStyles], function(p, c) { |
testAndCallback(inTest, fitTest(p, c), '', function() {removeTestNode(p); }); |
}); |
} |
dojo.addOnLoad(function(){ |
doh.register("t", |
[ |
function reciprocalTests(t) { |
createStyledNodes([], function(n) { |
testAndCallback(t, reciprocalMarginBoxTest(n), '', function() {removeTestNode(n); }); |
}); |
}, |
function fitTests(t) { |
runFitTest(t, null, dojo.mixin({}, defaultChildStyles)); |
}, |
function fitTestsOverflow(t) { |
runFitTest(t, null, dojo.mixin({overflow:'hidden'}, defaultChildStyles)); |
runFitTest(t, {overflow: 'hidden'}, dojo.mixin({}, defaultChildStyles)); |
runFitTest(t, {overflow: 'hidden'}, dojo.mixin({overflow:'hidden'}, defaultChildStyles)); |
}, |
function fitTestsFloat(t) { |
runFitTest(t, null, dojo.mixin({float: 'left'}, defaultChildStyles)); |
runFitTest(t, {float: 'left'}, dojo.mixin({}, defaultChildStyles)); |
runFitTest(t, {float: 'left'}, dojo.mixin({float: 'left'}, defaultChildStyles)); |
}, |
function reciprocalTestsInline(t) { |
createStyledParentChild([], [{}, null, 'span'], function(p, c) { |
c.innerHTML = 'Hello World'; |
testAndCallback(t, reciprocalMarginBoxTest(c), '', function() {removeTestNode(c); }); |
}); |
}, |
function reciprocalTestsButtonChild(t) { |
createStyledParentChild([], [{}, null, 'button'], function(p, c) { |
c.innerHTML = 'Hello World'; |
testAndCallback(t, reciprocalMarginBoxTest(c), '', function() {removeTestNode(c); }); |
}); |
} |
] |
); |
doh.run(); |
}); |
</script> |
<style type="text/css"> |
html, body { |
padding: 0px; |
margin: 0px; |
border: 0px; |
} |
</style> |
</head> |
<body> |
</body> |
</html> |
/trunk/api/js/dojo1.0/dojo/tests/_base/html_box.html |
---|
New file |
0,0 → 1,207 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
<!-- |
we use a strict-mode DTD to ensure that the box model is the same for these |
basic tests |
--> |
<html> |
<head> |
<title> test html.js Box utils</title> |
<style type="text/css"> |
/*@import "../../resources/dojo.css";*/ |
</style> |
<script type="text/javascript" |
src="../../dojo.js" |
djConfig="isDebug: true"></script> |
<script type="text/javascript"> |
dojo.require("doh.runner"); |
var margin = '1px'; |
var border = '3px solid black'; |
var padding = '5px'; |
var defaultStyles = { |
height: '100px', |
width: '100px', |
position: 'absolute', |
backgroundColor: 'red' |
}; |
var defaultChildStyles = { |
height: '20px', |
width: '20px', |
backgroundColor: 'blue' |
} |
var testStyles = [ |
{}, |
{margin: margin}, |
{border: border}, |
{padding: padding}, |
{margin: margin, border: border}, |
{margin: margin, padding: padding}, |
{border: border, padding: padding}, |
{margin: margin, border: border, padding: padding} |
] |
function sameBox(inBox1, inBox2) { |
for (var i in inBox1) |
if (inBox1[i] != inBox2[i]) { |
console.log((arguments[2]||'box1') + '.' + i + ': ', inBox1[i], ' != ', (arguments[3]||'box2') + '.' + i + ': ', inBox2[i]); |
return false; |
} |
return true; |
} |
function reciprocalMarginBoxTest(inNode, inBox) { |
var s = inBox || dojo.marginBox(inNode); |
dojo.marginBox(inNode, s); |
var e = dojo.marginBox(inNode); |
return sameBox(s, e); |
} |
function fitTest(inParent, inChild) { |
var pcb = dojo.contentBox(inParent); |
return reciprocalMarginBoxTest(inChild, pcb); |
} |
function createStyledElement(inStyle, inParent, inElement, inNoDefault) { |
inStyle = inStyle||{}; |
if (!inNoDefault) { |
for (var i in defaultStyles) |
if (!inStyle[i]) |
inStyle[i] = defaultStyles[i]; |
} |
var n = document.createElement(inElement || 'div'); |
(inParent||document.body).appendChild(n); |
dojo.mixin(n.style, inStyle); |
return n; |
} |
var _testTopInc = 0; |
var _testTop = 150; |
var _testInitTop = 250; |
function styleIncTop(inStyle) { |
inStyle = dojo.mixin({}, inStyle||{}); |
inStyle.top = (_testInitTop + _testTop*_testTopInc) + 'px'; |
_testTopInc++; |
return inStyle; |
} |
function removeTestNode(inNode) { |
// leave nodes for inspection or don't return to delete them |
return; |
inNode = dojo.byId(inNode); |
inNode.parentNode.removeChild(inNode); |
_testTopInc--; |
} |
function testAndCallback(inTest, inAssert, inComment, inOk, inErr) { |
inTest.assertTrue('/* ' + inComment + '*/' + inAssert); |
if (inAssert) |
inOk&&inOk(); |
else |
inErr&&inErr(); |
} |
// args are (styles, parent, element name, no default) |
function mixCreateElementArgs(inMix, inArgs) { |
args = [{}]; |
if (inArgs&&inArgs[0]) |
dojo.mixin(args[0], inArgs[0]); |
if (inMix.length) |
dojo.mixin(args[0], inMix[0]||{}); |
// parent comes from source |
if (inMix.length > 1) |
args[1] = inMix[1]; |
args[2] = inArgs[2]; |
args[3] = inArgs[3] |
return args; |
}; |
function createStyledNodes(inArgs, inFunc) { |
for (var i=0, n; (s=testStyles[i]); i++) { |
n = createStyledElement.apply(this, mixCreateElementArgs([styleIncTop(s)], inArgs)); |
inFunc&&inFunc(n); |
} |
} |
function createStyledParentChild(inParentArgs, inChildArgs, inFunc) { |
for (var i=0, s, p, c; (s=testStyles[i]); i++) { |
p = createStyledElement.apply(this, mixCreateElementArgs([styleIncTop(s)], inParentArgs)); |
c = createStyledElement.apply(this, mixCreateElementArgs([{}, p], inChildArgs)); |
inFunc&&inFunc(p, c); |
} |
} |
function createStyledParentChildren(inParentArgs, inChildArgs, inFunc) { |
for (var i=0, s, p; (s=testStyles[i]); i++) |
for (var j=0, sc, c, props; (sc=testStyles[j]); j++) { |
p = createStyledElement.apply(this, mixCreateElementArgs([styleIncTop(s)], inParentArgs)); |
c = createStyledElement.apply(this, mixCreateElementArgs([sc, p], inChildArgs)); |
inFunc&&inFunc(p, c); |
} |
for (var i=0, s, p, c; (s=testStyles[i]); i++) { |
p = createStyledElement.apply(this, mixCreateElementArgs([styleIncTop(s)], inParentArgs)); |
c = createStyledElement.apply(this, mixCreateElementArgs([{}, p], inChildArgs)); |
inFunc&&inFunc(p, c); |
} |
} |
function runFitTest(inTest, inParentStyles, inChildStyles) { |
createStyledParentChildren([inParentStyles], [inChildStyles], function(p, c) { |
testAndCallback(inTest, fitTest(p, c), '', function() {removeTestNode(p); }); |
}); |
} |
dojo.addOnLoad(function(){ |
doh.register("t", |
[ |
function reciprocalTests(t) { |
createStyledNodes([], function(n) { |
testAndCallback(t, reciprocalMarginBoxTest(n), '', function() {removeTestNode(n); }); |
}); |
}, |
function fitTests(t) { |
runFitTest(t, null, dojo.mixin({}, defaultChildStyles)); |
}, |
function fitTestsOverflow(t) { |
runFitTest(t, null, dojo.mixin({overflow:'hidden'}, defaultChildStyles)); |
runFitTest(t, {overflow: 'hidden'}, dojo.mixin({}, defaultChildStyles)); |
runFitTest(t, {overflow: 'hidden'}, dojo.mixin({overflow:'hidden'}, defaultChildStyles)); |
}, |
function fitTestsFloat(t) { |
runFitTest(t, null, dojo.mixin({float: 'left'}, defaultChildStyles)); |
runFitTest(t, {float: 'left'}, dojo.mixin({}, defaultChildStyles)); |
runFitTest(t, {float: 'left'}, dojo.mixin({float: 'left'}, defaultChildStyles)); |
}, |
function reciprocalTestsInline(t) { |
createStyledParentChild([], [{}, null, 'span'], function(p, c) { |
c.innerHTML = 'Hello World'; |
testAndCallback(t, reciprocalMarginBoxTest(c), '', function() {removeTestNode(c); }); |
}); |
}, |
function reciprocalTestsButtonChild(t) { |
createStyledParentChild([], [{}, null, 'button'], function(p, c) { |
c.innerHTML = 'Hello World'; |
testAndCallback(t, reciprocalMarginBoxTest(c), '', function() {removeTestNode(c); }); |
}); |
} |
] |
); |
doh.run(); |
}); |
</script> |
<style type="text/css"> |
html, body { |
padding: 0px; |
margin: 0px; |
border: 0px; |
} |
</style> |
</head> |
<body> |
</body> |
</html> |
/trunk/api/js/dojo1.0/dojo/tests/_base/html.js |
---|
New file |
0,0 → 1,12 |
if(!dojo._hasResource["tests._base.html"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base.html"] = true; |
dojo.provide("tests._base.html"); |
if(dojo.isBrowser){ |
doh.registerUrl("tests._base.html", dojo.moduleUrl("tests", "_base/html.html")); |
doh.registerUrl("tests._base.html_rtl", dojo.moduleUrl("tests", "_base/html_rtl.html")); |
doh.registerUrl("tests._base.html_quirks", dojo.moduleUrl("tests", "_base/html_quirks.html")); |
doh.registerUrl("tests._base.html_box", dojo.moduleUrl("tests", "_base/html_box.html")); |
doh.registerUrl("tests._base.html_box_quirks", dojo.moduleUrl("tests", "_base/html_box_quirks.html")); |
} |
} |
/trunk/api/js/dojo1.0/dojo/tests/_base/fx.html |
---|
New file |
0,0 → 1,196 |
<html> |
<head> |
<title>testing Core FX</title> |
<style type="text/css"> |
@import "../../resources/dojo.css"; |
</style> |
<script type="text/javascript" |
src="../../dojo.js" |
djConfig="isDebug: true"></script> |
<script type="text/javascript" src="../../_base/fx.js"></script> |
<script type="text/javascript"> |
var duration = 1000; |
dojo.require("doh.runner"); |
dojo.addOnLoad(function(){ |
doh.register("t", |
[ |
{ |
name: "fadeOut", |
timeout: 1500, |
runTest: function(t){ |
var opacity = dojo.style('foo', 'opacity'); |
t.is(1, opacity); |
var anim = dojo.fadeOut({ node: 'foo', duration: duration }); |
var d = new doh.Deferred(); |
dojo.connect(anim, "onEnd", null, function(){ |
var opacity = dojo.style('foo', 'opacity'); |
// console.debug(anim._start); |
var elapsed = (new Date()) - anim._start; |
t.is(0, opacity); |
t.assertTrue(elapsed >= duration); |
d.callback(true); |
}); |
anim._start = new Date(); |
anim.play(); |
return d; |
} |
}, |
{ |
name: "fadeIn", |
timeout: 1500, |
runTest: function(t){ |
var opacity = dojo.style('foo', 'opacity'); |
t.is(0, opacity); |
var anim = dojo.fadeIn({ node: 'foo', duration: duration }); |
var d = new doh.Deferred(); |
dojo.connect(anim, "onEnd", null, function(){ |
var opacity = dojo.style('foo', 'opacity'); |
// console.debug(anim._start); |
var elapsed = (new Date()) - anim._start; |
t.is(1, opacity); |
t.assertTrue(elapsed >= duration); |
d.callback(true); |
}); |
anim._start = new Date(); |
anim.play(); |
return d; |
} |
}, |
{ |
name: "animateColor", |
timeout: 1500, |
runTest: function(t){ |
var d = new doh.Deferred(); |
var anim = dojo.animateProperty({ |
node: "foo", |
duration: duration, |
properties: { |
color: { start: "black", end: "white" }, |
backgroundColor: { start: "white", end: "black" } |
} |
}); |
dojo.connect(anim, "onEnd", anim, function(){ |
d.callback(true); |
}); |
anim.play(); |
return d; |
} |
}, |
{ |
name: "animateColorBack", |
timeout: 1500, |
runTest: function(t){ |
var d = new doh.Deferred(); |
var anim = dojo.animateProperty({ |
node: "foo", |
duration: duration, |
properties: { |
color: { end: "black" }, |
backgroundColor: { end: "#5d81b4" }, |
letterSpacing: { start: 0, end: 10 } |
} |
}); |
dojo.connect(anim, "onEnd", anim, function(){ |
d.callback(true); |
}); |
anim.play(); |
return d; |
} |
}, |
{ |
name: "animateHeight", |
timeout: 1500, |
runTest: function(t){ |
var startHeight = dojo.marginBox("foo").h; |
var endHeight = Math.round(startHeight / 2); |
var anim = dojo.animateProperty({ |
node: "foo", |
properties: { height: { end: endHeight } }, |
duration: duration |
}); |
var d = new doh.Deferred(); |
dojo.connect(anim, "onEnd", anim, function(){ |
var elapsed = (new Date().valueOf()) - anim._startTime; |
t.assertTrue(elapsed >= duration); |
var height = dojo.marginBox("foo").h; |
t.is(height, endHeight); |
d.callback(true); |
}); |
anim.play(); |
return d; |
} |
} |
] |
); |
doh.run(); |
}); |
</script> |
<style type="text/css"> |
body { |
margin: 1em; |
background-color: #DEDEDE; |
} |
.box { |
color: #292929; |
/* color: #424242; */ |
/* text-align: left; */ |
width: 300px; |
border: 1px solid #BABABA; |
background-color: white; |
padding-left: 10px; |
padding-right: 10px; |
margin-left: 10px; |
-o-border-radius: 10px; |
-moz-border-radius: 12px; |
-webkit-border-radius: 10px; |
/* -opera-border-radius: 10px; */ |
border-radius: 10px; |
-moz-box-sizing: border-box; |
-opera-sizing: border-box; |
-webkit-box-sizing: border-box; |
-khtml-box-sizing: border-box; |
box-sizing: border-box; |
overflow: hidden; |
/* position: absolute; */ |
} |
</style> |
</head> |
<body> |
<h1>testing Core FX</h1> |
<form name="testForm"> |
<input type="button" onClick="dojo.fadeOut({ node: 'foo', duration: 1000 }).play()" value="fade out"></input> |
<input type="button" onClick="dojo.fadeIn({ node: 'foo', duration: 1000 }).play()" value="fade in"></input> |
</form> |
<div id="foo" class="box" style="float: left;"> |
<p> |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean |
semper sagittis velit. Cras in mi. Duis porta mauris ut ligula. |
Proin porta rutrum lacus. Etiam consequat scelerisque quam. Nulla |
facilisi. Maecenas luctus venenatis nulla. In sit amet dui non mi |
semper iaculis. Sed molestie tortor at ipsum. Morbi dictum rutrum |
magna. Sed vitae risus. |
</p> |
<p> |
Aliquam vitae enim. Duis scelerisque metus auctor est venenatis |
imperdiet. Fusce dignissim porta augue. Nulla vestibulum. Integer |
lorem nunc, ullamcorper a, commodo ac, malesuada sed, dolor. Aenean |
id mi in massa bibendum suscipit. Integer eros. Nullam suscipit |
mauris. In pellentesque. Mauris ipsum est, pharetra semper, |
pharetra in, viverra quis, tellus. Etiam purus. Quisque egestas, |
tortor ac cursus lacinia, felis leo adipiscing nisi, et rhoncus |
elit dolor eget eros. Fusce ut quam. Suspendisse eleifend leo vitae |
ligula. Nulla facilisi. Nulla rutrum, erat vitae lacinia dictum, |
pede purus imperdiet lacus, ut semper velit ante id metus. Praesent |
massa dolor, porttitor sed, pulvinar in, consequat ut, leo. Nullam |
nec est. Aenean id risus blandit tortor pharetra congue. |
Suspendisse pulvinar. |
</p> |
</div> |
</body> |
</html> |
/trunk/api/js/dojo1.0/dojo/tests/_base/query.js |
---|
New file |
0,0 → 1,9 |
if(!dojo._hasResource["tests._base.query"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. |
dojo._hasResource["tests._base.query"] = true; |
dojo.provide("tests._base.query"); |
if(dojo.isBrowser){ |
doh.registerUrl("tests._base.query", dojo.moduleUrl("tests", "_base/query.html")); |
doh.registerUrl("tests._base.NodeList", dojo.moduleUrl("tests", "_base/NodeList.html")); |
} |
} |