Debian Codegraph @

dojox/mvc/tests/1.7/doh/doh_async_mvc_input-output-simple.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
5 <title>DOH Async Simple Input - Output Group example</title>
6 <style type="text/css">
7 @import "../../../../../dojo/resources/dojo.css";
8 @import "../../../../../dijit/tests/css/dijitTests.css";
9 @import "../css/app-format.css";
10 @import "../../../../../dijit/themes/claro/claro.css";
11 </style>
12 <script type="text/javascript" djConfig="parseOnLoad:0,isDebug:1,async:1" src="../../../../../dojo/dojo.js"></script>
13 <script type="text/javascript">
14 var model;
15
16 require([
17 'dojo/parser',
18 'dojox/mvc',
19 'dojox/mvc/Group',
20 'dojox/mvc/Output',
21 'dojo/parser',
22 'dijit/form/TextBox',
23 'dijit/form/Button'], function(){
24
25 // The dojox.mvc.StatefulModel class creates a data model instance
26 // where each leaf within the data model is decorated with dojo.Stateful
27 // properties that widgets can bind to and watch for their changes.
28 model = dojox.mvc.newStatefulModel({ data : { "First" : "John", "Last" : "Doe", "Email" : "[email protected]" }});
29 require([
30 'doh/runner', 'dijit/dijit'
31 ], function(){
32 require([
33 'dojo/domReady!'
34 ], function(){
35 doh.register("parse", function() {
36 dojo.parser.parse();
37 });
38 // should be able to verify all of the inputs
39 doh.register("check initial values and bindings", [{
40 name : "initial",
41 runTest : function() {
42 doh.is("John", dijit.byId("firstnameInput").get('value'),"firstnameInput should be John");
43 doh.is("John", dijit.byId("dojox_mvc_Output_0").get('value'),"dojox_mvc_Output_0 should be John");
44
45 doh.is("Doe", dijit.byId("lastnameInput").get('value'),"lastnameInput should be Doe");
46 doh.is("Doe", dijit.byId("dojox_mvc_Output_1").get('value'),"dojox_mvc_Output_1 should be Doe");
47
48 doh.is("[email protected]", dijit.byId("emailInput").get('value'),"emailInput should be [email protected]");
49 doh.is("[email protected]", dijit.byId("dojox_mvc_Output_2").get('value'),"dojox_mvc_Output_2 should be [email protected]");
50 }
51 }]);
52
53 doh.register("update first name", [{
54 name : "Update-First-Name",
55 runTest : function() {
56 var first1, bind1, addr1;
57 //test first relevant false
58 first1 = dijit.byId("firstnameInput");
59 first1.set("value","John-update");
60 if (first1) {
61 doh.is("John-update", dijit.byId("firstnameInput").get('value'),"firstnameInput should be John");
62 doh.is("John-update", dijit.byId("dojox_mvc_Output_0").get('value'),"dojox_mvc_Output_0 should be John");
63 }
64 }
65 }]);
66 doh.register("update last name", [{
67 name : "Update-Last-Name",
68 runTest : function() {
69 var last;
70 //test first relevant false
71 last = dijit.byId("lastnameInput");
72 last.set("value","Doe-update");
73 if (last) {
74 doh.is("Doe-update", dijit.byId("lastnameInput").get('value'),"lastnameInput should be Doe-update");
75 doh.is("Doe-update", dijit.byId("dojox_mvc_Output_1").get('value'),"dojox_mvc_Output_1 should be Doe-update");
76 }
77 }
78 }]);
79 doh.register("update last name", [{
80 name : "Update-Last-Name",
81 runTest : function() {
82 var last;
83 //test first relevant false
84 email = dijit.byId("emailInput");
85 email.set("value","[email protected]");
86 if (email) {
87 doh.is("[email protected]", dijit.byId("emailInput").get('value'),"emailInput should be [email protected]");
88 doh.is("[email protected]", dijit.byId("dojox_mvc_Output_2").get('value'),"dojox_mvc_Output_2 should be [email protected]");
89 }
90 }
91 }]);
92 doh.register("reset back to initial values and bindings", [{
93 name : "reset_test",
94 runTest : function() {
95 model.reset();
96 doh.is("John", dijit.byId("firstnameInput").get('value'),"firstnameInput should be John");
97 doh.is("John", dijit.byId("dojox_mvc_Output_0").get('value'),"dojox_mvc_Output_0 should be John");
98
99 doh.is("Doe", dijit.byId("lastnameInput").get('value'),"lastnameInput should be Doe");
100 doh.is("Doe", dijit.byId("dojox_mvc_Output_1").get('value'),"dojox_mvc_Output_1 should be Doe");
101
102 doh.is("[email protected]", dijit.byId("emailInput").get('value'),"emailInput should be [email protected]");
103 doh.is("[email protected]", dijit.byId("dojox_mvc_Output_2").get('value'),"dojox_mvc_Output_2 should be [email protected]");
104 }
105 }]);
106
107 doh.run();
108
109 });
110 });
111 });
112 </script>
113 </head>
114 <body class="claro">
115 <div id="wrapper">
116 <div id="header">
117 <div id="navigation"></div>
118 <div id="headerInsert">
119 <h1>Async Input Output Test</h1>
120 <h2>Data Binding Example</h2>
121 </div>
122 </div>
123 <div id="main">
124 <div id="leftNav"></div>
125 <div id="mainContent" dojoType="dojox.mvc.Group" data-dojo-props="ref: 'expr:model'">
126 <div class="row">
127 <label class="cell" for="firstnameInput">First:</label>
128 <input class="cell" id="firstnameInput" data-dojo-type="dijit.form.TextBox"
129 data-dojo-props="ref: model.First"></input>
130 <!-- Content in output below will always be in sync with value of textbox above -->
131 <span data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: 'First'">
132 (first name is: ${this.value})
133 </span>
134 </div>
135 <div class="row">
136 <label class="cell" for="lastnameInput">Last:</label>
137 <input class="cell" id="lastnameInput" data-dojo-type="dijit.form.TextBox"
138 data-dojo-props="ref: model.Last"></input>
139 <span data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: 'Last'">
140 (last name is: ${this.value})
141 </span>
142 </div>
143 <div class="row">
144 <label class="cell" for="emailInput">Email:</label>
145 <input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox"
146 data-dojo-props="ref: model.Email"></input>
147 <span data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: 'Email'">
148 (email is: ${this.value})
149 </span>
150 </div>
151 <br/>Model:
152 <button id="reset" type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){model.reset();}">Reset</button>
153 </div>
154 </div>
155 </div>
156 </body>
157
158 </html>