forked from YahooArchive/mojito-yaf-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
179 lines (146 loc) · 4.79 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- ================================================================= -->
<!--
NAME: index.html
AUTH: William J Edney (wje)
NOTE: Copyright (C) 2012 Yahoo! Inc.
-->
<!-- ================================================================= -->
<html>
<head>
<title>A Mojito / YAF integration test project</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style type="text/css">
#Message
{
position: absolute;
border: solid 1px black;
left: 10%;
right: 10%;
bottom: 0px;
height: 2em;
}
.mojit
{
border: solid 1px black;
}
</style>
<!-- The fully minified version of YUI -->
<script type="text/javascript"
src="http://yui.yahooapis.com/3.7.2/build/yui/yui-min.js"></script>
<!-- The debug version of YUI -->
<!--
<script type="text/javascript">
// Put YUI in debug mode so that we can step through it.
YUI_config = {filter: 'debug', useConsoleOutput: true};
</script>
<script type="text/javascript" src="http://yui.yahooapis.com/3.7.2/build/yui/yui-debug.js"></script>
-->
<script type="text/javascript" src="./lib/mojito-yaf.js"></script>
<script type="text/javascript" src="./lib/mojits/HTMLMojit/controller.client.js"></script>
<script type="text/javascript" src="./tests/test-dispatch.js"></script>
<script type="text/javascript" src="./tests/mojits/TestRootMojit/controller.client.js"></script>
<script type="text/javascript" src="./tests/mojits/MsgMojit/controller.client.js"></script>
<script type="text/javascript">
YUI().use('mojito-yaf', 'HTMLMojit', 'TestRootMojit', 'MsgMojit', function (Y) {
// ---
// !TODO! Hardcoded data in lieu of application.json / routes.json
// This is a hack for this test!
var configData = {
"context":{
},
"binderMap":{
"mainMojit":{
"base":null,
"name":"HTMLMojitBinder",
"action":"index",
"config":{
},
"type":"HTMLMojit",
"viewId":"mainMojit",
"instanceId":"mainMojitA"
},
"rootMojit":{
"base":null,
"name":"TestRootMojitBinder",
"action":"index",
"config":{
},
"type":"mojito.TestRootMojit",
"viewId":"rootMojit",
"instanceId":"rootMojitA"
},
"msgMojit":{
"base":null,
"name":"MsgMojitBinder",
"action":"index",
"config":{
},
"type":"mojito.MsgMojit",
"viewId":"msgMojit",
"instanceId":"msgMojitA"
}
},
"routes":{
"root":{
"verbs":{
"GET":true
},
"path":"/",
"call":"frame.index",
"name":"root",
"params":{
},
"regex":{
},
"query":{
},
"requires":{
},
"ext_match":"^/$",
"int_match":"^$"
},
"msg":{
"verbs":{
"GET":true
},
"path":"/foo",
"call":"foo.bar",
"name":"msg",
"params":{
},
"regex":{
},
"query":{
},
"requires":{
},
"ext_match":"^/foo$",
"int_match":"^$"
}
}
};
// !END TODO!
var app = new Y.App();
new Y.mojito.Builder({configData: configData, appObj: app});
app.navigate('/');
// ---
Y.one('#navigateButton').on('click',
function () {
app.navigate('/msgMojit:index');
});
Y.one('#goToFooRoute').on('click',
function () {
app.navigate('/foo');
});
Y.one('#alertAllMojits').on('click',
function () {
var stuff = Y.mojito.Controller.findAllControllers();
alert(Object.keys(stuff));
});
});
</script>
</head>
<body>
</body>
</html>