| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
| 3 |
<html> |
| 4 |
<head> |
| 5 |
<title>robot BorderContainer Test</title> |
| 6 |
|
| 7 |
<style> |
| 8 |
@import "../../../../util/doh/robot/robot.css"; |
| 9 |
</style> |
| 10 |
|
| 11 |
|
| 12 |
<script type="text/javascript" src="../../../../dojo/dojo.js" |
| 13 |
data-dojo-config="isDebug: true"></script> |
| 14 |
|
| 15 |
<script type="text/javascript"> |
| 16 |
require([ |
| 17 |
"doh/runner", "dojo/robotx", "dojo/dom", "dojo/dom-geometry", "dojo/keys", |
| 18 |
"dijit/tests/helpers", "dijit/tests/layout/robot/borderContainerTestFunctions", "dojo/domReady!" |
| 19 |
], function(doh, robot, dom, geom, keys, helpers, bcTest){ |
| 20 |
|
| 21 |
robot.initRobot('../test_BorderContainer.html'); |
| 22 |
|
| 23 |
var focus; |
| 24 |
|
| 25 |
doh.register("setup", [ |
| 26 |
function setup(){ |
| 27 |
// get pointers to singletons loaded on test page |
| 28 |
focus = robot.window.require("dijit/focus"); |
| 29 |
} |
| 30 |
]); |
| 31 |
|
| 32 |
doh.register("mouse", [ |
| 33 |
{ |
| 34 |
name: "expand right pane", |
| 35 |
timeout: 10000, |
| 36 |
runTest: function(t){ |
| 37 |
var d = new doh.Deferred(); |
| 38 |
|
| 39 |
var oTop = geom.position(dom.byId("border2-top")), |
| 40 |
oCenter = geom.position(dom.byId("border2-center")), |
| 41 |
oRight = geom.position(dom.byId("border2-trailing")), |
| 42 |
oBottom = geom.position(dom.byId("border2-bottom")); |
| 43 |
|
| 44 |
// Drag slider to expand pane |
| 45 |
var size = geom.position("border2-trailing_splitter"); |
| 46 |
robot.mouseMoveAt("border2-trailing_splitter", 500); |
| 47 |
robot.mousePress({left: true}, 500); |
| 48 |
robot.mouseMoveAt("border2-trailing_splitter", 500, 100, |
| 49 |
size.w/2 + (geom.isBodyLtr() ? -100 : 100), size.h/2); |
| 50 |
robot.mouseRelease({left: true}, 500); |
| 51 |
robot.sequence(d.getTestCallback(function(){ |
| 52 |
var nTop = geom.position(dom.byId("border2-top")), |
| 53 |
nCenter = geom.position(dom.byId("border2-center")), |
| 54 |
nRight = geom.position(dom.byId("border2-trailing")), |
| 55 |
nBottom = geom.position(dom.byId("border2-bottom")); |
| 56 |
|
| 57 |
doh.t(bcTest.within(oRight.w + 100, nRight.w, 10), "right width went from " + oRight.w + " to " + nRight.w); |
| 58 |
doh.t(bcTest.within(oTop.w - 100, nTop.w, 10), "top width went from " + oTop.w + " to " + nTop.w); |
| 59 |
doh.t(bcTest.within(oCenter.w - 100, nCenter.w, 10), "center width went from " + oCenter.w + " to " + nCenter.w); |
| 60 |
doh.t(bcTest.within(oBottom.w - 100, nBottom.w, 10), "bottom width went from " + nBottom.w + " to " + nBottom.w); |
| 61 |
}), 500); |
| 62 |
|
| 63 |
return d; |
| 64 |
} |
| 65 |
}, |
| 66 |
{ |
| 67 |
name: "shrink bottom pane", |
| 68 |
timeout: 10000, |
| 69 |
runTest: function(t){ |
| 70 |
var d = new doh.Deferred(); |
| 71 |
|
| 72 |
var oTop = geom.position(dom.byId("border2-top")), |
| 73 |
oCenter = geom.position(dom.byId("border2-center")), |
| 74 |
oRight = geom.position(dom.byId("border2-trailing")), |
| 75 |
oBottom = geom.position(dom.byId("border2-bottom")); |
| 76 |
|
| 77 |
// Drag slider to shrink pane |
| 78 |
var size = geom.position("border2-bottom_splitter"); |
| 79 |
robot.mouseMoveAt("border2-bottom_splitter", 500); |
| 80 |
robot.mousePress({left: true}, 500); |
| 81 |
robot.mouseMoveAt("border2-bottom_splitter", 500, 100, size.w/2, size.h/2 + 10); |
| 82 |
robot.mouseRelease({left: true}, 500); |
| 83 |
robot.sequence(d.getTestCallback(function(){ |
| 84 |
var nTop = geom.position(dom.byId("border2-top")), |
| 85 |
nCenter = geom.position(dom.byId("border2-center")), |
| 86 |
nRight = geom.position(dom.byId("border2-trailing")), |
| 87 |
nBottom = geom.position(dom.byId("border2-bottom")); |
| 88 |
|
| 89 |
doh.t(bcTest.within(oBottom.h - 10, nBottom.h, 10), "bottom height went from " + oBottom.h + " to " + nBottom.h); |
| 90 |
doh.t(bcTest.within(oCenter.h + 10, nCenter.h, 10), "center height went from " + oCenter.h + " to " + nCenter.h); |
| 91 |
}), 500); |
| 92 |
|
| 93 |
return d; |
| 94 |
} |
| 95 |
} |
| 96 |
]); |
| 97 |
|
| 98 |
doh.register("keyboard", [ |
| 99 |
{ |
| 100 |
name: "tabIndex", |
| 101 |
timeout: 10000, |
| 102 |
runTest: function(t){ |
| 103 |
var d = new doh.Deferred(); |
| 104 |
robot.sequence(function(){ |
| 105 |
dom.byId("toggleLeftButton").focus(); |
| 106 |
}, 500, 500); |
| 107 |
|
| 108 |
// Tab into second BorderContainer, landing on link |
| 109 |
robot.keyPress(keys.TAB, 500, {}); |
| 110 |
robot.sequence(d.getTestErrback(function(){ |
| 111 |
doh.is("a link", helpers.innerText(focus.curNode), "tabbed to link"); |
| 112 |
}), 500); |
| 113 |
|
| 114 |
// Tab past ComboBox to get to splitter for bottom panel |
| 115 |
robot.keyPress(keys.TAB, 500, {}); |
| 116 |
robot.keyPress(keys.TAB, 500, {}); |
| 117 |
robot.sequence(d.getTestErrback(function(){ |
| 118 |
doh.is("border2-bottom_splitter", focus.curNode.id, "focus on bottom splitter"); |
| 119 |
}), 500); |
| 120 |
|
| 121 |
// Tab to get to splitter for right panel |
| 122 |
robot.keyPress(keys.TAB, 500, {}); |
| 123 |
robot.sequence(d.getTestErrback(function(){ |
| 124 |
doh.is("border2-trailing_splitter", focus.curNode.id, "focus on bottom splitter"); |
| 125 |
}), 500); |
| 126 |
|
| 127 |
// tab out of BorderContainer, into the next one |
| 128 |
robot.keyPress(keys.TAB, 500, {}); |
| 129 |
robot.sequence(d.getTestCallback(function(){ |
| 130 |
doh.is("a link", helpers.innerText(focus.curNode), "tabbed to link in next BC"); |
| 131 |
}), 500); |
| 132 |
|
| 133 |
return d; |
| 134 |
} |
| 135 |
}, |
| 136 |
|
| 137 |
{ |
| 138 |
name: "expand/contract", |
| 139 |
timeout: 10000, |
| 140 |
runTest: function(t){ |
| 141 |
var d = new doh.Deferred(); |
| 142 |
|
| 143 |
var oSize, nSize; |
| 144 |
|
| 145 |
// contract bottom pane |
| 146 |
robot.sequence(function(){ |
| 147 |
dom.byId("border2-bottom_splitter").focus(); |
| 148 |
oSize = geom.position("border2-bottom"); |
| 149 |
}, 500, 500); |
| 150 |
robot.keyPress(keys.DOWN_ARROW, 500, {}); |
| 151 |
robot.sequence(d.getTestErrback(function(){ |
| 152 |
nSize = geom.position("border2-bottom"); |
| 153 |
doh.t(nSize.h < oSize.h, "contracted bottom pane"); |
| 154 |
}), 500); |
| 155 |
|
| 156 |
// expand trailing pane |
| 157 |
robot.sequence(function(){ |
| 158 |
dom.byId("border2-trailing_splitter").focus(); |
| 159 |
oSize = geom.position("border2-trailing"); |
| 160 |
}, 500, 500); |
| 161 |
robot.keyPress(geom.isBodyLtr() ? keys.LEFT_ARROW : keys.RIGHT_ARROW, 500, {}); |
| 162 |
robot.sequence(d.getTestCallback(function(){ |
| 163 |
nSize = geom.position("border2-trailing"); |
| 164 |
doh.t(nSize.w > oSize.w, "expanded trailing pane"); |
| 165 |
}), 500); |
| 166 |
|
| 167 |
return d; |
| 168 |
} |
| 169 |
} |
| 170 |
]); |
| 171 |
|
| 172 |
doh.run(); |
| 173 |
}); |
| 174 |
</script> |
| 175 |
</head> |
| 176 |
</html> |