Files
openlayers/master/examples/doh_mvc_template_repeat_exprchar.html
Éric Lemoine 5d14b9e2d4 Updated
2013-02-20 10:38:25 +01:00

237 lines
7.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>MVC DOH Test</title>
<style>
@import "../../../dojo/resources/dojo.css";
@import "./css/dijitTests.css";
@import "css/app-format.css";
</style>
<!-- required: the default dijit theme: -->
<link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/>
<!-- required: dojo.js -->
<script src="../../../dojo/dojo.js" type="text/javascript"
djConfig="isDebug: true">
</script>
<script type="text/javascript" src="./helpers.js"></script>
<script type="text/javascript">
dojo.require("dojox.mvc");
dojo.require("dojox.mvc.Group");
dojo.require("dojox.mvc.Repeat");
dojo.require("dijit.form.TextBox");
dojo.require("dijit.form.Button");
dojo.require("dojo.parser");
dojo.require("dojox.mvc.tests.test_templatedWidget.myMvcTemplated");
// Raw records for the master detail
var search_results_init = {
"Query": "Engineers",
"Results": [{
"First": "Anne",
"Last": "Ackerman",
"Location": "NY",
"Office": "1S76",
"Email": "a.a@test.com",
"Tel": "123-764-8237",
"Fax": "123-764-8228"
}, {
"First": "Ben",
"Last": "Beckham",
"Location": "NY",
"Office": "5N47",
"Email": "b.b@test.com",
"Tel": "123-764-8599",
"Fax": "123-764-8600"
}, {
"First": "John",
"Last": "Jacklin",
"Location": "CA",
"Office": "6701",
"Email": "j.j@test.com",
"Tel": "408-764-1234",
"Fax": "408-764-4321"
}]
};
// The dojox.mvc.StatefulModel class creates a data model instance
// where each leaf within the data model is decorated with dojo.Stateful
// properties that widgets can bind to and watch for their changes.
var searchRecords = dojox.mvc.newStatefulModel({
data: search_results_init
});
dojo.ready(function(){
dojo.parser.parse();
});
</script>
<script type="text/javascript">
dojo.require('doh.runner');
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dojo.parser"); // scan page for widgets and instantiate them
dojo.addOnLoad(function() {
doh.register("parse", function() {
dojo.parser.parse();
});
// should be able to verify all of the inputs
doh.register("check initial values for Input0s", [{
name : "initial",
runTest : function() {
var name1, bind1;
//test nameInput0
name1 = dijit.byId("nameInput0");
if (name1) {
bind1 = name1.get("binding");
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) {
doh.is("Anne",bind1.data,"bind1.data should be set");
doh.is("Anne",bind1.value,"bind1.value should be set");
}
}
//test anameInput0
name1 = dijit.byId("anameInput0");
if (name1) {
bind1 = name1.get("binding");
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) {
doh.is("Anne",bind1.data,"bind1.data should be set");
doh.is("Anne",bind1.value,"bind1.value should be set");
}
}
//test bnameInput0
name1 = dijit.byId("bnameInput0");
if (name1) {
bind1 = name1.get("binding");
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) {
doh.is("Anne",bind1.data,"bind1.data should be set");
doh.is("Anne",bind1.value,"bind1.value should be set");
}
}
//test 9nameInput0
name1 = dijit.byId("9nameInput0");
if (name1) {
bind1 = name1.get("binding");
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) {
doh.is("Anne",bind1.data,"bind1.data should be set");
doh.is("Anne",bind1.value,"bind1.value should be set");
}
}
}
}]);
doh.register("check initial values for Input1s", [{
name : "initial",
runTest : function() {
var name1, bind1;
//test nameInput1
name1 = dijit.byId("nameInput1");
if (name1) {
bind1 = name1.get("binding");
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) {
doh.is("Ben",bind1.data,"bind1.data should be set");
doh.is("Ben",bind1.value,"bind1.value should be set");
}
}
//test anameInput1
name1 = dijit.byId("anameInput1");
if (name1) {
bind1 = name1.get("binding");
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) {
doh.is("Ben",bind1.data,"bind1.data should be set");
doh.is("Ben",bind1.value,"bind1.value should be set");
}
}
//test bnameInput1
name1 = dijit.byId("bnameInput1");
if (name1) {
bind1 = name1.get("binding");
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) {
doh.is("Ben",bind1.data,"bind1.data should be set");
doh.is("Ben",bind1.value,"bind1.value should be set");
}
}
//test 9nameInput1
name1 = dijit.byId("9nameInput1");
if (name1) {
bind1 = name1.get("binding");
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) {
doh.is("Ben",bind1.data,"bind1.data should be set");
doh.is("Ben",bind1.value,"bind1.value should be set");
}
}
}
}]);
doh.register("check initial values for Input2s", [{
name : "initial",
runTest : function() {
var name1, bind1;
//test nameInput1
name1 = dijit.byId("nameInput2");
if (name1) {
bind1 = name1.get("binding");
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) {
doh.is("John",bind1.data,"bind1.data should be set");
doh.is("John",bind1.value,"bind1.value should be set");
}
}
//test anameInput2
name1 = dijit.byId("anameInput2");
if (name1) {
bind1 = name1.get("binding");
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) {
doh.is("John",bind1.data,"bind1.data should be set");
doh.is("John",bind1.value,"bind1.value should be set");
}
}
//test bnameInput2
name1 = dijit.byId("bnameInput2");
if (name1) {
bind1 = name1.get("binding");
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) {
doh.is("John",bind1.data,"bind1.data should be set");
doh.is("John",bind1.value,"bind1.value should be set");
}
}
//test 9nameInput2
name1 = dijit.byId("9nameInput2");
if (name1) {
bind1 = name1.get("binding");
if (bind1 && bind1.isInstanceOf(dojox.mvc.StatefulModel)) {
doh.is("John",bind1.data,"bind1.data should be set");
doh.is("John",bind1.value,"bind1.value should be set");
}
}
}
}]);
doh.run();
});
</script>
</head>
<body class="claro" style="background-image: url(../images/master_detail.png)">
<div id="wrapper">
<div id="main">
<div id="leftNav"></div>
<div id="mainContent">
<div>
Test exprchar. Widget template test uses exprchar of # and others for template:#{this.index} etc.
</div>
<br/>
<div id="container2" data-dojo-type="dojox.mvc.tests.test_templatedWidget.myMvcTemplated">
</div>
</div>
</div>
</div>
</body>
</html>