Debian Codegraph @

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