| 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 nested 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", |
| 18 |
"dojo/_base/array", "dojo/dom", "dojo/dom-geometry", "dojo/keys", |
| 19 |
"dijit/tests/helpers", "dijit/tests/layout/robot/borderContainerTestFunctions", "dojo/domReady!" |
| 20 |
], function(doh, robot, array, dom, geom, keys, helpers, bcTest){ |
| 21 |
|
| 22 |
function checkLayoutPriorityBC(){ |
| 23 |
bcTest.checkAbove("top bar above second top bar", "top1", "top2"); |
| 24 |
bcTest.checkAbove("second top bar above inner top bar", "top2", "top3"); |
| 25 |
bcTest.checkLeft("outer left vs. inner left", "left1", "left2"); |
| 26 |
bcTest.checkLeft("inner left vs. inner top", "left2", "top3"); |
| 27 |
bcTest.checkLeft("inner left vs. inner bottom", "left2", "bottom3"); |
| 28 |
bcTest.checkAbove("inner top vs. center", "top3", "center"); |
| 29 |
bcTest.checkAbove("center vs. inner bottom", "center", "bottom3"); |
| 30 |
bcTest.checkLeft("inner right vs. inner top", "top3", "right2"); |
| 31 |
bcTest.checkLeft("inner right vs. center", "center", "right2"); |
| 32 |
bcTest.checkAbove("inner bottom bar above second bottom bar", "bottom3", "bottom2"); |
| 33 |
bcTest.checkAbove("second bottom bar above bottom bar", "bottom2", "bottom1"); |
| 34 |
} |
| 35 |
|
| 36 |
robot.initRobot('../test_BorderContainer_nested.html'); |
| 37 |
|
| 38 |
var registry; |
| 39 |
|
| 40 |
doh.register("setup", [ |
| 41 |
function setup(){ |
| 42 |
// get pointers to singletons loaded on test page |
| 43 |
registry = robot.window.require("dijit/registry"); |
| 44 |
} |
| 45 |
]); |
| 46 |
|
| 47 |
doh.register("initial layout", [ |
| 48 |
function nestedBC(){ |
| 49 |
bcTest.checkBCpanes(registry.byId("nbc")); |
| 50 |
doh.t(helpers.isVisible(registry.byId("nbc"))); |
| 51 |
bcTest.checkInside("nbc", "tc"); |
| 52 |
}, |
| 53 |
function layoutPriorityBC(){ |
| 54 |
registry.byId("tc").selectChild(registry.byId("pbc")); |
| 55 |
doh.t(helpers.isVisible(registry.byId("pbc")), "second pane visible"); |
| 56 |
|
| 57 |
// Check layout of BorderContainer panes relative to each other |
| 58 |
checkLayoutPriorityBC(); |
| 59 |
|
| 60 |
// Check that all panes within BC borders |
| 61 |
var children = registry.byId("pbc").getChildren(); |
| 62 |
doh.is(11, children.length, "# of children"); |
| 63 |
array.forEach(children, function(child){ |
| 64 |
bcTest.checkInside(child, registry.byId("pbc")); |
| 65 |
}); |
| 66 |
} |
| 67 |
]); |
| 68 |
|
| 69 |
// Verify that tab stops are as per original markup (i.e., children are still in the |
| 70 |
// logical order specified in the original markup). The tabstops not listed here |
| 71 |
// are for the splitters themselves. |
| 72 |
doh.register("tabIndex", function tabstops(){ |
| 73 |
var tabstops = tabOrder(registry.byId("pbc").domNode); |
| 74 |
doh.is(21, tabstops.length); |
| 75 |
doh.is("tabstop #1", tabstops[0].value); |
| 76 |
doh.is("tabstop #3", tabstops[2].value); |
| 77 |
doh.is("tabstop #5", tabstops[4].value); |
| 78 |
doh.is("tabstop #7", tabstops[6].value); |
| 79 |
doh.is("tabstop #9", tabstops[8].value); |
| 80 |
doh.is("tabstop #11", tabstops[10].value); |
| 81 |
doh.is("tabstop #12", tabstops[12].value); |
| 82 |
doh.is("tabstop #14", tabstops[14].value); |
| 83 |
doh.is("tabstop #16", tabstops[16].value); |
| 84 |
doh.is("tabstop #18", tabstops[18].value); |
| 85 |
doh.is("tabstop #20", tabstops[20].value); |
| 86 |
}); |
| 87 |
|
| 88 |
doh.register("keyboard", [ |
| 89 |
{ |
| 90 |
name: "top1", |
| 91 |
timeout: 10000, |
| 92 |
runTest: function(){ |
| 93 |
var d = new doh.Deferred(); |
| 94 |
|
| 95 |
var top1Size, centerSize; |
| 96 |
|
| 97 |
robot.sequence(function(){ |
| 98 |
dom.byId("top1_splitter").focus(); |
| 99 |
|
| 100 |
top1Size = geom.position("top1"); |
| 101 |
centerSize = geom.position("center"); |
| 102 |
}, 500, 500); |
| 103 |
|
| 104 |
robot.keyPress(keys.DOWN_ARROW, 500, {}); |
| 105 |
robot.keyPress(keys.DOWN_ARROW, 500, {}); |
| 106 |
robot.keyPress(keys.DOWN_ARROW, 500, {}); |
| 107 |
|
| 108 |
robot.sequence(d.getTestCallback(function(){ |
| 109 |
doh.t(bcTest.within(top1Size.h + 3, geom.position("top1").h, 0.5), "top size increased"); |
| 110 |
doh.t(bcTest.within(centerSize.h - 3, geom.position("center").h, 0.5), "center size decreased"); |
| 111 |
}), 500); |
| 112 |
|
| 113 |
return d; |
| 114 |
} |
| 115 |
}, |
| 116 |
{ |
| 117 |
name: "right1", |
| 118 |
timeout: 10000, |
| 119 |
runTest: function(){ |
| 120 |
var d = new doh.Deferred(); |
| 121 |
|
| 122 |
var right1Size, centerSize, top2Size, bottom1Size; |
| 123 |
|
| 124 |
robot.sequence(function(){ |
| 125 |
dom.byId("right1_splitter").focus(); |
| 126 |
|
| 127 |
right1Size = geom.position("right1"); |
| 128 |
centerSize = geom.position("center"); |
| 129 |
top2Size = geom.position("top2"); |
| 130 |
bottom1Size = geom.position("bottom1"); |
| 131 |
}, 500, 500); |
| 132 |
|
| 133 |
robot.keyPress(keys.LEFT_ARROW, 500, {}); |
| 134 |
robot.keyPress(keys.LEFT_ARROW, 500, {}); |
| 135 |
robot.keyPress(keys.LEFT_ARROW, 500, {}); |
| 136 |
|
| 137 |
robot.sequence(d.getTestCallback(function(){ |
| 138 |
doh.t(bcTest.within(right1Size.w + 3, geom.position("right1").w, 0.5), "right size increased"); |
| 139 |
doh.t(bcTest.within(centerSize.w - 3, geom.position("center").w, 0.5), "center size decreased"); |
| 140 |
doh.t(bcTest.within(centerSize.w - 3, geom.position("top3").w, 0.5), "inner top size decreased"); |
| 141 |
doh.t(bcTest.within(centerSize.w - 3, geom.position("bottom3").w, 0.5), "inner bottom size decreased"); |
| 142 |
doh.t(bcTest.within(top2Size.h, geom.position("top2").h, 0.5), "top2 height unchanged"); |
| 143 |
doh.t(bcTest.within(top2Size.w, geom.position("top2").w, 0.5), "top2 width unchanged"); |
| 144 |
doh.t(bcTest.within(bottom1Size.h, geom.position("bottom1").h, 0.5), "bottom1 height unchanged"); |
| 145 |
doh.t(bcTest.within(bottom1Size.w, geom.position("bottom1").w, 0.5), "bottom1 width unchanged"); |
| 146 |
}), 500); |
| 147 |
|
| 148 |
return d; |
| 149 |
} |
| 150 |
} |
| 151 |
]); |
| 152 |
|
| 153 |
doh.run(); |
| 154 |
}); |
| 155 |
</script> |
| 156 |
</head> |
| 157 |
</html> |