Debian Codegraph @

dojox/mvc/tests/doh/doh_mvc_search-results-repeat-store.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>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 <!-- required: the default dijit theme: -->
14 <link id="themeStyles" rel="stylesheet" href="../../../../dijit/themes/claro/claro.css">
15
16 <!-- required: dojo.js -->
17 <script src="../../../../dojo/dojo.js" type="text/javascript" data-dojo-config="parseOnLoad: 0, isDebug: 1, mvc: {debugBindings: 1}"></script>
18 <script type="text/javascript" src="./helpers.js"></script>
19
20 <script type="text/javascript" >
21 require([
22 "doh/runner",
23 "dojo/_base/declare",
24 "dojo/when",
25 "dojo/dom",
26 "dojo/parser",
27 "dojo/promise/all",
28 "dojo/store/JsonRest",
29 "dijit/registry",
30 "dijit/_WidgetBase",
31 "dojox/mvc/getStateful",
32 "dojox/mvc/EditModelRefController",
33 "dojox/mvc/ListController",
34 "dijit/form/TextBox",
35 "dijit/form/Button",
36 "dojox/mvc/Group",
37 "dojox/mvc/Repeat",
38 "dojo/domReady!"
39 ], function(doh, declare, when, ddom, parser, all, JsonRest, registry, _WidgetBase, getStateful, EditModelRefController, ListController){
40
41 var ctrlClass = declare([_WidgetBase, EditModelRefController, ListController], {});
42 (ctrl = (new ctrlClass({srcNodeRef: ddom.byId("detailsGroup"), cursorIndex: 0}))).startup();
43
44 when(all([parser.parse(), new JsonRest({target: require.toUrl("dojox/mvc/tests/_data/mvcRepeatData.json")}).query({})]), function(a){
45 ctrl.set("sourceModel", getStateful(a[1].items));
46
47 // should be able to verify all of the inputs
48 doh.register("Check values and bindings", [
49 {
50 name: "Initial",
51 runTest: function(){
52 doh.is("Anne", registry.byId("nameInput0").value, "nameInput0 should be Anne");
53 doh.is("Anne", registry.byId("firstInput").value, "firstInput should be Anne");
54 }
55 }, {
56 name: "TestBen",
57 runTest: function(){
58 ctrl.set("cursorIndex", 1);
59 doh.is("Ben", registry.byId("nameInput1").value, "nameInput1 should be Ben");
60 doh.is("Ben", registry.byId("firstInput").value, "firstInput should be Ben");
61 }
62 }, {
63 name: "TestJohn",
64 runTest: function(){
65 ctrl.set("cursorIndex", 9);
66 doh.is("John", registry.byId("nameInput9").value, "nameInput9 should be John");
67 doh.is("John", registry.byId("firstInput").value, "firstInput should be John");
68
69 registry.byId("firstInput").set("value", "Johnny");
70
71 doh.is("Johnny", ctrl.get("model").get(9).get("First"), "First name of the 10th entry should be changed to Johnny");
72 }
73 }, {
74 name: "TestCommitReset",
75 runTest: function(){
76 ctrl.set("cursorIndex", 8);
77
78 doh.is("Irene", registry.byId("nameInput8").value, "nameInput8 should be Irene");
79 doh.is("Irene", registry.byId("firstInput").value, "firstInput should be Irene");
80
81 registry.byId("firstInput").set("value", "IreneThisUpdateShouldBeSaved");
82
83 ctrl.commit();
84
85 registry.byId("lastInput").set("value", "IraThisUpdateShouldBeReset");
86
87 ctrl.reset();
88
89 doh.is("IreneThisUpdateShouldBeSaved", registry.byId("nameInput8").value, "nameInput8 should be IreneThisUpdateShouldBeSaved");
90 doh.is("IreneThisUpdateShouldBeSaved", registry.byId("firstInput").value, "firstInput should be IreneThisUpdateShouldBeSaved");
91 doh.is("Ira", registry.byId("lastInput").value, "lastInput should be Ira");
92 }
93 }
94 ]);
95
96 doh.run();
97 });
98 });
99 </script>
100 </head>
101 <body class="claro">
102 <script type="dojo/require">at: "dojox/mvc/at"</script>
103 <h1 class="testTitle">doh_mvc_programmatic-repeat-store.html automated tests (non-robot)</h1>
104 <div id="wrapper">
105 <div id="header">
106 <div id="navigation"></div>
107 <div id="headerInsert">
108 <h2>Master Detail Example - With repeat container, using a store, with save, commit and reset.</h2>
109 </div>
110 </div>
111 <div id="main">
112 <div id="leftNav"></div>
113 <div id="mainContent">
114 <div id="searchBanner">Search Results for term: </div>
115 <table>
116 <tbody>
117 <tr>
118 <td>
119 <div>
120 <div>Declarative Repeat using my.Repeat does not pass templateString: </div>
121 <div id="repeatId" data-dojo-type="dojox.mvc.Repeat" data-dojo-props="children: at(ctrl, 'model')">
122 <div class="row" data-dojo-type="dojox.mvc.Group" data-dojo-props="target: at('rel:', '${this.index}')">
123 <label class="cell" for="nameInput${this.index}">Name:</label>
124 <input class="cell" data-dojo-type="dijit.form.TextBox" id="nameInput${this.index}" data-dojo-props="value: at('rel:', 'First')"/>
125 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){ ctrl.set('cursorIndex', '${this.index}'); }">Details</button>
126 </div>
127 </div>
128 </div>
129 </td>
130 </tr>
131 </tbody>
132 </table>
133 <div class="spacer"></div>
134 <div id="detailsBanner">Details for selected index:</div>
135 <div id="detailsGroup">
136 <div class="row">
137 <label class="cell" for="firstInput">First Name:</label>
138 <input class="cell" id="firstInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'First')">
139 </div>
140 <div class="row">
141 <label class="cell" for="lastInput">Last Name:</label>
142 <input class="cell" id="lastInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Last')">
143 </div>
144 <div class="row">
145 <label class="cell" for="locationInput">Location:</label>
146 <input class="cell" id="locationInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Location')">
147 </div>
148 <div class="row">
149 <label class="cell" for="officeInput">Office:</label>
150 <input class="cell" id="officeInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Office')">
151 </div>
152 <div class="row">
153 <label class="cell" for="emailInput">Email:</label>
154 <input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Email')">
155 </div>
156 <div class="row">
157 <label class="cell" for="telInput">Telephone:</label>
158 <input class="cell" id="telInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Tel')">
159 </div>
160 <div class="row">
161 <label class="cell" for="faxInput">Fax:</label>
162 <input class="cell" id="faxInput" data-dojo-type="dijit.form.TextBox" data-dojo-props="value: at('rel:', 'Fax')">
163 </div>
164 <div class="row">
165 <div class="spacer"></div>
166 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){ ctrl.commit();}">Commit All</button>
167 <button type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){ ctrl.reset(); }">Reset to last saved</button>
168 </div>
169 </div>
170 </div>
171 </div>
172 </div>
173 </body>
174 </html>