@@ -71,19 +71,8 @@ TestCase {
73 // Find an object with the given name in the children tree of "obj"
73 // Find an object with the given name in the children tree of "obj"
74− function findChild(obj,objectName) {
74+ function findChild(obj, objectName) {
75− var childs = new Array(0);
75+ return findChildIn(obj, "children", objectName);
77− while (childs.length > 0) {
78− if (childs[0].objectName == objectName) {
81− for (var i in childs[0].children) {
82− childs.push(childs[0].children[i])
89 // Find an object with the given name in the children tree of "obj"
78 // Find an object with the given name in the children tree of "obj"
@@ -91,15 +80,20 @@ TestCase {
91 // Note: you should use findChild if you're not sure you need this
80 // Note: you should use findChild if you're not sure you need this
92 // as this tree is much bigger and might contain stuff that goes
81 // as this tree is much bigger and might contain stuff that goes
93 // away randomly.
82 // away randomly.
94− function findInvisibleChild(obj,objectName) {
83+ function findInvisibleChild(obj, objectName) {
84+ return findChildIn(obj, "data", objectName);
87+ // Find a child in the named property
88+ function findChildIn(obj, prop, objectName) {
95 var childs = new Array(0);
89 var childs = new Array(0);
96 childs.push(obj)
90 childs.push(obj)
97 while (childs.length > 0) {
91 while (childs.length > 0) {
98 if (childs[0].objectName == objectName) {
92 if (childs[0].objectName == objectName) {
99 return childs[0]
93 return childs[0]
101− for (var i in childs[0].data) {
95+ for (var i in childs[0][prop]) {
102− childs.push(childs[0].data[i])
96+ childs.push(childs[0][prop][i])
104 childs.splice(0, 1);
98 childs.splice(0, 1);