| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 |
<title>MVC DOH Test</title> |
| 6 |
|
| 7 |
<style> |
| 8 |
@import "../../../../../dojo/resources/dojo.css"; |
| 9 |
@import "../../../../../dijit/tests/css/dijitTests.css"; |
| 10 |
@import "../css/app-format.css"; |
| 11 |
</style> |
| 12 |
|
| 13 |
|
| 14 |
<link id="themeStyles" rel="stylesheet" href="../../../../../dijit/themes/claro/claro.css"/> |
| 15 |
|
| 16 |
|
| 17 |
<script src="../../../../../dojo/dojo.js" type="text/javascript" |
| 18 |
djConfig="isDebug: true"> |
| 19 |
</script> |
| 20 |
<script type="text/javascript" src="../helpers.js"></script> |
| 21 |
|
| 22 |
<script type="text/javascript"> |
| 23 |
dojo.require("dojox.mvc"); |
| 24 |
dojo.require("dojox.mvc.Group"); |
| 25 |
dojo.require("dojox.mvc.Repeat"); |
| 26 |
dojo.require("dijit.form.TextBox"); |
| 27 |
dojo.require("dijit.form.Button"); |
| 28 |
dojo.require("dojo.parser"); |
| 29 |
dojo.registerModulePath("17", "../dojox/mvc/tests/1.7"); |
| 30 |
dojo.require("17.test_templatedWidget.myMvcTemplated"); |
| 31 |
|
| 32 |
// Raw records for the master detail |
| 33 |
var search_results_init = { |
| 34 |
"Query": "Engineers", |
| 35 |
"Results": [{ |
| 36 |
"First": "Anne", |
| 37 |
"Last": "Ackerman", |
| 38 |
"Location": "NY", |
| 39 |
"Office": "1S76", |
| 40 |
"Email": "[email protected]", |
| 41 |
"Tel": "123-764-8237", |
| 42 |
"Fax": "123-764-8228" |
| 43 |
}, { |
| 44 |
"First": "Ben", |
| 45 |
"Last": "Beckham", |
| 46 |
"Location": "NY", |
| 47 |
"Office": "5N47", |
| 48 |
"Email": "[email protected]", |
| 49 |
"Tel": "123-764-8599", |
| 50 |
"Fax": "123-764-8600" |
| 51 |
}, { |
| 52 |
"First": "John", |
| 53 |
"Last": "Jacklin", |
| 54 |
"Location": "CA", |
| 55 |
"Office": "6701", |
| 56 |
"Email": "[email protected]", |
| 57 |
"Tel": "408-764-1234", |
| 58 |
"Fax": "408-764-4321" |
| 59 |
}] |
| 60 |
}; |
| 61 |
|
| 62 |
// The dojox.mvc.StatefulModel class creates a data model instance |
| 63 |
// where each leaf within the data model is decorated with dojo.Stateful |
| 64 |
// properties that widgets can bind to and watch for their changes. |
| 65 |
var searchRecords = dojox.mvc.newStatefulModel({ |
| 66 |
data: search_results_init |
| 67 |
}); |
| 68 |
|
| 69 |
dojo.ready(function(){ |
| 70 |
dojo.parser.parse(); |
| 71 |
}); |
| 72 |
</script> |
| 73 |
|
| 74 |
<script type="text/javascript"> |
| 75 |
dojo.require('doh.runner'); |
| 76 |
dojo.require("dijit.dijit"); // optimize: load dijit layer |
| 77 |
dojo.require("dojo.parser"); // scan page for widgets and instantiate them |
| 78 |
|
| 79 |
dojo.addOnLoad(function() { |
| 80 |
|
| 81 |
doh.register("parse", function() { |
| 82 |
dojo.parser.parse(); |
| 83 |
}); |
| 84 |
|
| 85 |
// should be able to verify all of the inputs |
| 86 |
doh.register("check initial values for Input0s", [{ |
| 87 |
name : "initial", |
| 88 |
runTest : function() { |
| 89 |
var name1, bind1; |
| 90 |
//test nameInput0 |
| 91 |
name1 = dijit.byId("nameInput0"); |
| 92 |
if (name1) { |
| 93 |
bind1 = name1.get("binding"); |
| 94 |
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) { |
| 95 |
doh.is("Anne",bind1.data,"bind1.data should be set"); |
| 96 |
doh.is("Anne",bind1.value,"bind1.value should be set"); |
| 97 |
} |
| 98 |
} |
| 99 |
//test anameInput0 |
| 100 |
name1 = dijit.byId("anameInput0"); |
| 101 |
if (name1) { |
| 102 |
bind1 = name1.get("binding"); |
| 103 |
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) { |
| 104 |
doh.is("Anne",bind1.data,"bind1.data should be set"); |
| 105 |
doh.is("Anne",bind1.value,"bind1.value should be set"); |
| 106 |
} |
| 107 |
} |
| 108 |
//test bnameInput0 |
| 109 |
name1 = dijit.byId("bnameInput0"); |
| 110 |
if (name1) { |
| 111 |
bind1 = name1.get("binding"); |
| 112 |
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) { |
| 113 |
doh.is("Anne",bind1.data,"bind1.data should be set"); |
| 114 |
doh.is("Anne",bind1.value,"bind1.value should be set"); |
| 115 |
} |
| 116 |
} |
| 117 |
//test 9nameInput0 |
| 118 |
name1 = dijit.byId("9nameInput0"); |
| 119 |
if (name1) { |
| 120 |
bind1 = name1.get("binding"); |
| 121 |
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) { |
| 122 |
doh.is("Anne",bind1.data,"bind1.data should be set"); |
| 123 |
doh.is("Anne",bind1.value,"bind1.value should be set"); |
| 124 |
} |
| 125 |
} |
| 126 |
} |
| 127 |
}]); |
| 128 |
|
| 129 |
doh.register("check initial values for Input1s", [{ |
| 130 |
name : "initial", |
| 131 |
runTest : function() { |
| 132 |
var name1, bind1; |
| 133 |
//test nameInput1 |
| 134 |
name1 = dijit.byId("nameInput1"); |
| 135 |
if (name1) { |
| 136 |
bind1 = name1.get("binding"); |
| 137 |
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) { |
| 138 |
doh.is("Ben",bind1.data,"bind1.data should be set"); |
| 139 |
doh.is("Ben",bind1.value,"bind1.value should be set"); |
| 140 |
} |
| 141 |
} |
| 142 |
//test anameInput1 |
| 143 |
name1 = dijit.byId("anameInput1"); |
| 144 |
if (name1) { |
| 145 |
bind1 = name1.get("binding"); |
| 146 |
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) { |
| 147 |
doh.is("Ben",bind1.data,"bind1.data should be set"); |
| 148 |
doh.is("Ben",bind1.value,"bind1.value should be set"); |
| 149 |
} |
| 150 |
} |
| 151 |
//test bnameInput1 |
| 152 |
name1 = dijit.byId("bnameInput1"); |
| 153 |
if (name1) { |
| 154 |
bind1 = name1.get("binding"); |
| 155 |
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) { |
| 156 |
doh.is("Ben",bind1.data,"bind1.data should be set"); |
| 157 |
doh.is("Ben",bind1.value,"bind1.value should be set"); |
| 158 |
} |
| 159 |
} |
| 160 |
//test 9nameInput1 |
| 161 |
name1 = dijit.byId("9nameInput1"); |
| 162 |
if (name1) { |
| 163 |
bind1 = name1.get("binding"); |
| 164 |
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) { |
| 165 |
doh.is("Ben",bind1.data,"bind1.data should be set"); |
| 166 |
doh.is("Ben",bind1.value,"bind1.value should be set"); |
| 167 |
} |
| 168 |
} |
| 169 |
} |
| 170 |
}]); |
| 171 |
|
| 172 |
doh.register("check initial values for Input2s", [{ |
| 173 |
name : "initial", |
| 174 |
runTest : function() { |
| 175 |
var name1, bind1; |
| 176 |
//test nameInput1 |
| 177 |
name1 = dijit.byId("nameInput2"); |
| 178 |
if (name1) { |
| 179 |
bind1 = name1.get("binding"); |
| 180 |
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) { |
| 181 |
doh.is("John",bind1.data,"bind1.data should be set"); |
| 182 |
doh.is("John",bind1.value,"bind1.value should be set"); |
| 183 |
} |
| 184 |
} |
| 185 |
//test anameInput2 |
| 186 |
name1 = dijit.byId("anameInput2"); |
| 187 |
if (name1) { |
| 188 |
bind1 = name1.get("binding"); |
| 189 |
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) { |
| 190 |
doh.is("John",bind1.data,"bind1.data should be set"); |
| 191 |
doh.is("John",bind1.value,"bind1.value should be set"); |
| 192 |
} |
| 193 |
} |
| 194 |
//test bnameInput2 |
| 195 |
name1 = dijit.byId("bnameInput2"); |
| 196 |
if (name1) { |
| 197 |
bind1 = name1.get("binding"); |
| 198 |
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) { |
| 199 |
doh.is("John",bind1.data,"bind1.data should be set"); |
| 200 |
doh.is("John",bind1.value,"bind1.value should be set"); |
| 201 |
} |
| 202 |
} |
| 203 |
//test 9nameInput2 |
| 204 |
name1 = dijit.byId("9nameInput2"); |
| 205 |
if (name1) { |
| 206 |
bind1 = name1.get("binding"); |
| 207 |
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) { |
| 208 |
doh.is("John",bind1.data,"bind1.data should be set"); |
| 209 |
doh.is("John",bind1.value,"bind1.value should be set"); |
| 210 |
} |
| 211 |
} |
| 212 |
} |
| 213 |
}]); |
| 214 |
|
| 215 |
doh.run(); |
| 216 |
|
| 217 |
}); |
| 218 |
</script> |
| 219 |
</head> |
| 220 |
|
| 221 |
<body class="claro" style="background-image: url(../images/master_detail.png)"> |
| 222 |
<div id="wrapper"> |
| 223 |
<div id="main"> |
| 224 |
<div id="leftNav"></div> |
| 225 |
<div id="mainContent"> |
| 226 |
<div> |
| 227 |
Test exprchar. Widget template test uses exprchar of # and others for template:#{this.index} etc. |
| 228 |
</div> |
| 229 |
<br/> |
| 230 |
<div id="container2" data-dojo-type="dojox.mvc.tests.test_templatedWidget.myMvcTemplated"> |
| 231 |
</div> |
| 232 |
</div> |
| 233 |
</div> |
| 234 |
</div> |
| 235 |
</body> |
| 236 |
|
| 237 |
</html> |