sproutit-sproutcore 1.0.20090721145251 → 1.0.20090721145280
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +3 -3
- data/VERSION.yml +2 -2
- data/frameworks/sproutcore/Buildfile +0 -1
- data/gen/app/templates/apps/@target_name@/core.js +27 -0
- data/gen/app/templates/apps/@target_name@/english.lproj/loading.rhtml +9 -0
- data/gen/app/templates/apps/@target_name@/english.lproj/main_page.js +22 -0
- data/gen/app/templates/apps/@target_name@/english.lproj/strings.js +15 -0
- data/gen/app/templates/apps/@target_name@/main.js +30 -0
- data/gen/controller/templates/controllers/@filename@.js +18 -0
- data/gen/controller/templates/tests/controllers/@filename@.js +15 -0
- data/gen/framework/templates/frameworks/@target_name@/core.js +21 -0
- data/gen/framework/templates/frameworks/@target_name@/english.lproj/strings.js +15 -0
- data/gen/language/templates/@filename@/strings.js +14 -0
- data/gen/model/templates/fixtures/@filename@.js +35 -0
- data/gen/model/templates/models/@filename@.js +19 -0
- data/gen/model/templates/tests/models/@filename@.js +15 -0
- data/gen/project/templates/@filename@/Buildfile +7 -0
- data/gen/project/templates/@filename@/README +7 -0
- data/gen/test/templates/tests/@filename@.js +15 -0
- data/gen/theme/templates/themes/@target_name@/english.lproj/strings.js +15 -0
- data/gen/view/templates/tests/views/@filename@.js +15 -0
- data/gen/view/templates/views/@filename@.js +18 -0
- data/lib/sproutcore/models/generator.rb +2 -2
- metadata +21 -33
- data/frameworks/sproutcore/frameworks/deprecated/core.js +0 -59
- data/frameworks/sproutcore/frameworks/deprecated/lib/button_views.rb +0 -330
- data/frameworks/sproutcore/frameworks/deprecated/lib/collection_view.rb +0 -83
- data/frameworks/sproutcore/frameworks/deprecated/lib/core_views.rb +0 -326
- data/frameworks/sproutcore/frameworks/deprecated/lib/form_views.rb +0 -253
- data/frameworks/sproutcore/frameworks/deprecated/lib/index.rhtml +0 -75
- data/frameworks/sproutcore/frameworks/deprecated/lib/menu_views.rb +0 -93
- data/frameworks/sproutcore/frameworks/deprecated/server/rails_server.js +0 -80
- data/frameworks/sproutcore/frameworks/deprecated/server/rest_server.js +0 -178
- data/frameworks/sproutcore/frameworks/deprecated/server/server.js +0 -673
- data/frameworks/sproutcore/frameworks/deprecated/system/animator.js +0 -679
- data/frameworks/sproutcore/frameworks/deprecated/system/binding.js +0 -36
- data/frameworks/sproutcore/frameworks/deprecated/system/browser.js +0 -75
- data/frameworks/sproutcore/frameworks/deprecated/system/classic_responder.js +0 -312
- data/frameworks/sproutcore/frameworks/deprecated/system/event.js +0 -58
- data/frameworks/sproutcore/frameworks/deprecated/system/globals.js +0 -20
- data/frameworks/sproutcore/frameworks/deprecated/system/misc.js +0 -58
- data/frameworks/sproutcore/frameworks/deprecated/system/node_descriptor.js +0 -72
- data/frameworks/sproutcore/frameworks/deprecated/system/object.js +0 -122
- data/frameworks/sproutcore/frameworks/deprecated/system/path_module.js +0 -432
- data/frameworks/sproutcore/frameworks/deprecated/system/string.js +0 -107
- data/frameworks/sproutcore/frameworks/deprecated/tests/application/application.rhtml +0 -125
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/clippingFrame.rhtml +0 -401
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/frame.rhtml +0 -357
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/isVisibleInWindow.rhtml +0 -147
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/base.rhtml +0 -298
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/incremental_rendering.rhtml +0 -260
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/source_list_rendering.rhtml +0 -143
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/popup_button.rhtml +0 -128
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/text_field.rhtml +0 -37
- data/frameworks/sproutcore/frameworks/deprecated/views/collection.js +0 -24
@@ -1,357 +0,0 @@
|
|
1
|
-
<% # ========================================================================
|
2
|
-
# SC.ClassicView Frame/Rects Unit Test
|
3
|
-
#
|
4
|
-
# This test validates the various frame properties for a view given
|
5
|
-
# different configurations.
|
6
|
-
#
|
7
|
-
# ========================================================================
|
8
|
-
%>
|
9
|
-
<% content_for('final') do %>
|
10
|
-
|
11
|
-
<script>
|
12
|
-
|
13
|
-
Test.context("CASE 1: Auto-layout view with no padding & no border", {
|
14
|
-
|
15
|
-
"frame should reflect current offset settings": function() {
|
16
|
-
var el = this.v.rootElement ;
|
17
|
-
var f = { x: el.offsetTop, y: el.offsetLeft, width: el.offsetWidth, height: el.offsetHeight };
|
18
|
-
// console.log(this.v.get('frame').x) ;
|
19
|
-
// console.log('this.frame', this.v.get('frame')) ;
|
20
|
-
SC.rectsEqual(f, this.v.get('frame')).shouldEqual(true) ;
|
21
|
-
},
|
22
|
-
|
23
|
-
"frame should change when CSS changed": function() {
|
24
|
-
var origFrame = this.v.get('frame') ;
|
25
|
-
|
26
|
-
this.v.addClassName('half') ;
|
27
|
-
this.v.viewFrameDidChange() ;
|
28
|
-
|
29
|
-
SC.rectsEqual(this.v.get('frame'), origFrame).shouldEqual(false) ;
|
30
|
-
|
31
|
-
// remove the class. make sure we have restored the frame
|
32
|
-
this.v.removeClassName('half') ; //reset
|
33
|
-
this.v.viewFrameDidChange() ;
|
34
|
-
SC.rectsEqual(this.v.get('frame'), origFrame).shouldEqual(true) ;
|
35
|
-
},
|
36
|
-
|
37
|
-
"setting frame should change style, even if it does not impact actual value": function() {
|
38
|
-
var f = this.v.get('frame') ;
|
39
|
-
var ret = this.v.set('frame', { x: 10, y: 10 }) ;
|
40
|
-
|
41
|
-
// it should change the style though
|
42
|
-
this.v.getStyle('left').shouldEqual('10px');
|
43
|
-
this.v.getStyle('top').shouldEqual('10px');
|
44
|
-
|
45
|
-
// change the top & left. Since the layout is static here, this should not actually
|
46
|
-
// change anything.
|
47
|
-
SC.rectsEqual(ret, f).shouldEqual(true) ;
|
48
|
-
},
|
49
|
-
|
50
|
-
setup: function() { this.v = SC.page.get('case1'); }
|
51
|
-
|
52
|
-
});
|
53
|
-
//
|
54
|
-
// CASE 2: Manual-layout of view
|
55
|
-
Test.context("CASE 2: Manual-layout of view", {
|
56
|
-
|
57
|
-
"frame should reflect current offset settings at first": function() {
|
58
|
-
var el = this.v.rootElement ;
|
59
|
-
var f = { x: el.offsetTop, y: el.offsetLeft, width: el.offsetWidth, height: el.offsetHeight };
|
60
|
-
SC.rectsEqual(f, this.v.get('frame')).shouldEqual(true) ;
|
61
|
-
},
|
62
|
-
|
63
|
-
"should get absolute positioning": function() {
|
64
|
-
this.v.getStyle('position').shouldEqual('absolute') ;
|
65
|
-
},
|
66
|
-
|
67
|
-
"frame should reflect set values exactly": function() {
|
68
|
-
var f = { x: 10, y: 10, width: 20, height: 20 } ;
|
69
|
-
var ret = this.v.set('frame', f);
|
70
|
-
SC.rectsEqual(f,ret).shouldEqual(true) ;
|
71
|
-
SC.rectsEqual(this.v.get('frame'), f).shouldEqual(true) ;
|
72
|
-
},
|
73
|
-
|
74
|
-
"actual offset should reflect set values exactly": function() {
|
75
|
-
var f = { x: 10, y: 10, width: 20, height: 20 } ;
|
76
|
-
var ret = this.v.set('frame', f);
|
77
|
-
var el = this.v.rootElement;
|
78
|
-
el.offsetLeft.shouldEqual(10) ;
|
79
|
-
el.offsetTop.shouldEqual(10) ;
|
80
|
-
el.offsetWidth.shouldEqual(20) ;
|
81
|
-
el.offsetHeight.shouldEqual(20) ;
|
82
|
-
},
|
83
|
-
|
84
|
-
"applying CSS class should not change frame": function() {
|
85
|
-
var f = this.v.get('frame') ;
|
86
|
-
this.v.addClassName('half') ;
|
87
|
-
SC.rectsEqual(this.v.get('frame'),f).shouldEqual(true) ;
|
88
|
-
},
|
89
|
-
|
90
|
-
"getting frame should cache the value": function() {
|
91
|
-
f = this.v.get('frame') ;
|
92
|
-
this.assertNotNull(this.v._frame) ;
|
93
|
-
},
|
94
|
-
|
95
|
-
setup: function() { this.v = SC.page.get('case2'); }
|
96
|
-
|
97
|
-
});
|
98
|
-
|
99
|
-
// CASE 3: Manual-layout View with padding & border
|
100
|
-
Test.context("CASE 3: Manual-layout of view with padding & border", {
|
101
|
-
|
102
|
-
"frame size should include padding and border": function() {
|
103
|
-
var f = v.get('frame') ;
|
104
|
-
var el = v.rootElement ;
|
105
|
-
|
106
|
-
//debugger ;
|
107
|
-
equals(Math.round(v.get('styleWidth')), f.width-24, 'width') ;
|
108
|
-
equals(Math.round(v.get('styleHeight')), f.height-24, 'height') ;
|
109
|
-
},
|
110
|
-
|
111
|
-
"changing frame size should subtract padding and border": function() {
|
112
|
-
this.v.set('frame', { width: 50, height: 50 }) ;
|
113
|
-
var f = this.v.get('frame') ;
|
114
|
-
f.width.shouldEqual(50) ;
|
115
|
-
f.height.shouldEqual(50);
|
116
|
-
|
117
|
-
var el = this.v.rootElement ;
|
118
|
-
Math.round(parseFloat(el.getStyle('width'),0)).shouldEqual(f.width - 24) ;
|
119
|
-
Math.round(parseFloat(el.getStyle('height'),0)).shouldEqual(f.height - 24) ;
|
120
|
-
},
|
121
|
-
|
122
|
-
setup: function() { this.v = SC.page.get('case3'); }
|
123
|
-
|
124
|
-
}) ;
|
125
|
-
|
126
|
-
// CASE 4: Child view inside of view with overflow = hidden
|
127
|
-
// NOTE: Cases 4,5 & 6 test a specific bug in FireFox.
|
128
|
-
Test.context("CASE 4: Absolute positioned Child view inside of view with overflow = hidden", {
|
129
|
-
|
130
|
-
"frame origin should be 0,0 & size should match owner's innerFrame": function() {
|
131
|
-
var vf = this.v.get('innerFrame') ;
|
132
|
-
var f = this.v.child.get('frame') ;
|
133
|
-
f.x.shouldEqual(0) ;
|
134
|
-
f.y.shouldEqual(0) ;
|
135
|
-
f.width.shouldEqual(62) ;
|
136
|
-
},
|
137
|
-
|
138
|
-
"nested frame origin should be 0,0 inside of parent": function() {
|
139
|
-
var f = this.v.child.nestedChild.get('frame') ;
|
140
|
-
f.x.shouldEqual(0) ;
|
141
|
-
f.y.shouldEqual(0) ;
|
142
|
-
},
|
143
|
-
|
144
|
-
"setting child frame should reflect in new frame value": function() {
|
145
|
-
this.v.child.set('frame', { x: 10, y: 10 }) ;
|
146
|
-
var f = this.v.child.get('frame') ;
|
147
|
-
f.x.shouldEqual(10) ;
|
148
|
-
f.y.shouldEqual(10) ;
|
149
|
-
},
|
150
|
-
|
151
|
-
setup: function() { this.v = SC.page.get('case4'); }
|
152
|
-
|
153
|
-
}) ;
|
154
|
-
|
155
|
-
// CASE 5: Child view inside of view with overflow = hidden
|
156
|
-
Test.context("CASE 5: Non-positioned Child view inside of view with overflow = hidden", {
|
157
|
-
|
158
|
-
"frame origin should be 0,0 & size should match owner's innerFrame": function() {
|
159
|
-
SC.DEBUGIT = YES ;
|
160
|
-
var vf = this.v.get('innerFrame') ;
|
161
|
-
var f = this.v.child.get('frame') ;
|
162
|
-
f.x.shouldEqual(0) ;
|
163
|
-
f.y.shouldEqual(0) ;
|
164
|
-
f.width.shouldEqual(vf.width) ;
|
165
|
-
SC.DEBUGIT = NO ;
|
166
|
-
},
|
167
|
-
|
168
|
-
"nested frame origin should be 1,1 to account for border offset of parent": function() {
|
169
|
-
var f = this.v.child.nestedChild.get('frame') ;
|
170
|
-
f.x.shouldEqual(1) ;
|
171
|
-
f.y.shouldEqual(1) ;
|
172
|
-
},
|
173
|
-
|
174
|
-
"setting child frame should not move child frame": function() {
|
175
|
-
this.v.child.set('frame', { x: 10, y: 10 }) ;
|
176
|
-
var f = this.v.child.get('frame') ;
|
177
|
-
f.x.shouldEqual(0) ;
|
178
|
-
f.y.shouldEqual(0) ;
|
179
|
-
},
|
180
|
-
|
181
|
-
setup: function() { this.v = SC.page.get('case5'); }
|
182
|
-
|
183
|
-
}) ;
|
184
|
-
|
185
|
-
Test.context("CASE 6: Relative positioned Child view inside of view with overflow = hidden", {
|
186
|
-
|
187
|
-
"frame origin should be 0,0 & size should match owner's innerFrame": function() {
|
188
|
-
var vf = this.v.get('innerFrame') ;
|
189
|
-
var f = this.v.child.get('frame') ;
|
190
|
-
f.x.shouldEqual(0) ;
|
191
|
-
f.y.shouldEqual(0) ;
|
192
|
-
f.width.shouldEqual(62) ;
|
193
|
-
},
|
194
|
-
|
195
|
-
"nested frame origin should be 0,0 inside of parent": function() {
|
196
|
-
var f = this.v.child.nestedChild.get('frame') ;
|
197
|
-
f.x.shouldEqual(0) ;
|
198
|
-
f.y.shouldEqual(0) ;
|
199
|
-
},
|
200
|
-
|
201
|
-
"setting child frame should reflect in new frame value that includes borders": function() {
|
202
|
-
this.v.child.set('frame', { x: 10, y: 10 }) ;
|
203
|
-
var f = this.v.child.get('frame') ;
|
204
|
-
f.x.shouldEqual(10) ;
|
205
|
-
f.y.shouldEqual(10) ;
|
206
|
-
},
|
207
|
-
|
208
|
-
setup: function() { this.v = SC.page.get('case6'); }
|
209
|
-
|
210
|
-
}) ;
|
211
|
-
|
212
|
-
Test.context("CASE 7: Create view (not in the window)", {
|
213
|
-
|
214
|
-
"frame should be 10,10,30,30 even though it is not on screen": function() {
|
215
|
-
var f = { x: 10, y: 10, width: 30, height: 30 };
|
216
|
-
var vf = this.v.get('frame') ;
|
217
|
-
SC.rectsEqual(f,vf).shouldEqual(true) ;
|
218
|
-
},
|
219
|
-
|
220
|
-
"resizing frame should update frame": function() {
|
221
|
-
var f = { x: 20, y: 20, width: 40, height: 40 } ;
|
222
|
-
this.v.set('frame', f) ;
|
223
|
-
var vf = this.v.get('frame') ;
|
224
|
-
SC.rectsEqual(f,vf).shouldEqual(true) ;
|
225
|
-
},
|
226
|
-
|
227
|
-
setup: function() { this.v = SC.ClassicView.extend({
|
228
|
-
emptyElement: '<div style="width: 30px; height: 30px; left: 10px; top: 10px; position: absolute;"></div>'
|
229
|
-
}).create(); }
|
230
|
-
|
231
|
-
}) ;
|
232
|
-
|
233
|
-
main = function() { SC.page.awake(); };
|
234
|
-
|
235
|
-
</script>
|
236
|
-
|
237
|
-
<% end %>
|
238
|
-
|
239
|
-
<% # Create the views for the various use cases. %>
|
240
|
-
<% content_for('page_javascript') do %>
|
241
|
-
<script>
|
242
|
-
</script>
|
243
|
-
<% end %>
|
244
|
-
|
245
|
-
<% content_for('body') do %>
|
246
|
-
|
247
|
-
<style>
|
248
|
-
|
249
|
-
.case { background-color: white; }
|
250
|
-
.case .child { border: 1px red solid; }
|
251
|
-
|
252
|
-
.base {
|
253
|
-
float: left;
|
254
|
-
width: 200px;
|
255
|
-
height: 100px;
|
256
|
-
border: 1px #aaa solid;
|
257
|
-
position: relative;
|
258
|
-
margin: 2px;
|
259
|
-
}
|
260
|
-
|
261
|
-
.cases { position: absolute; bottom: 0 ; left: 0; right: 0; border-top: 1px #ccc solid; }
|
262
|
-
|
263
|
-
.base label {
|
264
|
-
position: absolute;
|
265
|
-
bottom: 4px;
|
266
|
-
left: 4px;
|
267
|
-
}
|
268
|
-
|
269
|
-
.half { width: 50%; }
|
270
|
-
|
271
|
-
.case2, .case3 { position: absolute; }
|
272
|
-
|
273
|
-
.case3 {
|
274
|
-
border: 2px red solid ;
|
275
|
-
padding: 10px;
|
276
|
-
}
|
277
|
-
|
278
|
-
.case4 {
|
279
|
-
overflow: hidden;
|
280
|
-
position: relative;
|
281
|
-
border-left: 5px blue solid;
|
282
|
-
height: 60px;
|
283
|
-
}
|
284
|
-
|
285
|
-
.case5 {
|
286
|
-
overflow: auto;
|
287
|
-
position: relative;
|
288
|
-
border-left: 5px blue solid;
|
289
|
-
height: 60px;
|
290
|
-
}
|
291
|
-
|
292
|
-
.case4 .child {
|
293
|
-
position: absolute;
|
294
|
-
width: 60px;
|
295
|
-
}
|
296
|
-
|
297
|
-
.case6 .child {
|
298
|
-
position: relative;
|
299
|
-
width: 60px;
|
300
|
-
}
|
301
|
-
|
302
|
-
.nested_child { border: 1px green solid; }
|
303
|
-
|
304
|
-
</style>
|
305
|
-
|
306
|
-
<div class="cases">
|
307
|
-
<div class="base">
|
308
|
-
<label>Case 1</label>
|
309
|
-
<% view :case1, :class => 'case' do %>
|
310
|
-
<%= view :child, :outlet => true, :inner_html => 'Child' %>
|
311
|
-
<% end %>
|
312
|
-
</div>
|
313
|
-
|
314
|
-
<div class="base">
|
315
|
-
<label>Case 2</label>
|
316
|
-
<% view :case2, :class => 'case' do %>
|
317
|
-
<%= view :child, :outlet => true, :inner_html => 'Child' %>
|
318
|
-
<% end %>
|
319
|
-
</div>
|
320
|
-
|
321
|
-
<div class="base">
|
322
|
-
<label>Case 3</label>
|
323
|
-
<% view :case3, :class => 'case' do %>
|
324
|
-
<%= view :child, :outlet => true, :inner_html => 'Child' %>
|
325
|
-
<% end %>
|
326
|
-
</div>
|
327
|
-
|
328
|
-
<div class="base">
|
329
|
-
<label>Case 4</label>
|
330
|
-
<% view :case4, :class => 'case' do %>
|
331
|
-
<% view :child, :outlet => true do %>
|
332
|
-
<%= view :nested_child, :outlet => true, :inner_html => 'Nested' %>
|
333
|
-
<% end %>
|
334
|
-
<% end %>
|
335
|
-
</div>
|
336
|
-
|
337
|
-
<div class="base">
|
338
|
-
<label>Case 5</label>
|
339
|
-
<% view :case5, :class => 'case' do %>
|
340
|
-
<% view :child, :outlet => true do %>
|
341
|
-
<%= view :nested_child, :outlet => true, :inner_html => 'Nested' %>
|
342
|
-
<% end %>
|
343
|
-
<% end %>
|
344
|
-
</div>
|
345
|
-
|
346
|
-
<div class="base">
|
347
|
-
<label>Case 6</label>
|
348
|
-
<% view :case6, :class => 'case' do %>
|
349
|
-
<% view :child, :outlet => true do %>
|
350
|
-
<%= view :nested_child, :outlet => true, :inner_html => 'Nested' %>
|
351
|
-
<% end %>
|
352
|
-
<% end %>
|
353
|
-
</div>
|
354
|
-
|
355
|
-
</div>
|
356
|
-
|
357
|
-
<% end %>
|
data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/isVisibleInWindow.rhtml
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
<% # ========================================================================
|
2
|
-
# SC.ClassicView isVisibleInWindow Unit Test
|
3
|
-
# ========================================================================
|
4
|
-
%>
|
5
|
-
<% content_for('final') do %>
|
6
|
-
|
7
|
-
<script>
|
8
|
-
|
9
|
-
var FRAME = { x: 10, y: 10, width: 30, height: 30 } ;
|
10
|
-
|
11
|
-
Test.context("CASE 1: View created outside of window", {
|
12
|
-
|
13
|
-
"initial isVisibleInWindow should be false": function() {
|
14
|
-
v.get('isVisibleInWindow').shouldEqual(false) ;
|
15
|
-
},
|
16
|
-
|
17
|
-
"adding to window should make it true": function() {
|
18
|
-
SC.page.get('root').get('isVisibleInWindow').shouldEqual(true) ;
|
19
|
-
|
20
|
-
SC.page.get('root').appendChild(v) ;
|
21
|
-
v.get('isVisibleInWindow').shouldEqual(true) ;
|
22
|
-
},
|
23
|
-
|
24
|
-
"removing from window should make it false again": function() {
|
25
|
-
SC.page.get('root').appendChild(v) ;
|
26
|
-
v.get('isVisibleInWindow').shouldEqual(true) ;
|
27
|
-
|
28
|
-
v.removeFromParent() ;
|
29
|
-
v.get('isVisibleInWindow').shouldEqual(false) ;
|
30
|
-
},
|
31
|
-
|
32
|
-
setup: function() {
|
33
|
-
v = SC.ClassicView.extend({
|
34
|
-
emptyElement: '<div class="case"></div>'
|
35
|
-
}).create();
|
36
|
-
}
|
37
|
-
|
38
|
-
});
|
39
|
-
|
40
|
-
Test.context("CASE 2: View in body", {
|
41
|
-
|
42
|
-
"initial isVisibleInWindow should be true": function() {
|
43
|
-
v.get('isVisibleInWindow').shouldEqual(true) ;
|
44
|
-
},
|
45
|
-
|
46
|
-
"moving to another view in window should still be true": function() {
|
47
|
-
SC.page.get('root').appendChild(v) ;
|
48
|
-
v.get('isVisibleInWindow').shouldEqual(true) ;
|
49
|
-
},
|
50
|
-
|
51
|
-
"removing from window should make it false": function() {
|
52
|
-
v.removeFromParent() ;
|
53
|
-
v.get('isVisibleInWindow').shouldEqual(false) ;
|
54
|
-
|
55
|
-
// readd to window
|
56
|
-
SC.page.get('root').appendChild(v) ;
|
57
|
-
},
|
58
|
-
|
59
|
-
"moving to a view that is offscreen should make it false": function() {
|
60
|
-
v.get('isVisibleInWindow').shouldEqual(true) ;
|
61
|
-
offscreen.appendChild(v) ;
|
62
|
-
v.get('isVisibleInWindow').shouldEqual(false) ;
|
63
|
-
},
|
64
|
-
|
65
|
-
setup: function() {
|
66
|
-
v = SC.page.get('case2');
|
67
|
-
offscreen = SC.ClassicView.create() ;
|
68
|
-
}
|
69
|
-
});
|
70
|
-
|
71
|
-
Test.context("CASE 3: View created in resources", {
|
72
|
-
|
73
|
-
"initial isVisibleInWindow should be YES": function() {
|
74
|
-
v.get('isVisibleInWindow').shouldEqual(YES) ;
|
75
|
-
},
|
76
|
-
|
77
|
-
"moving to a visible view in window should be true": function() {
|
78
|
-
SC.page.get('root').appendChild(v) ;
|
79
|
-
v.get('isVisibleInWindow').shouldEqual(true) ;
|
80
|
-
},
|
81
|
-
|
82
|
-
"removing from window should make it false": function() {
|
83
|
-
v.removeFromParent() ;
|
84
|
-
v.get('isVisibleInWindow').shouldEqual(false) ;
|
85
|
-
},
|
86
|
-
|
87
|
-
"moving to a view that is offscreen should make it false": function() {
|
88
|
-
offscreen.appendChild(v) ;
|
89
|
-
v.get('isVisibleInWindow').shouldEqual(false) ;
|
90
|
-
},
|
91
|
-
|
92
|
-
setup: function() {
|
93
|
-
v = SC.page.get('case3');
|
94
|
-
offscreen = SC.ClassicView.create() ;
|
95
|
-
}
|
96
|
-
|
97
|
-
});
|
98
|
-
|
99
|
-
main = function() { SC.page.awake(); };
|
100
|
-
|
101
|
-
</script>
|
102
|
-
|
103
|
-
<% end %>
|
104
|
-
|
105
|
-
<% content_for('body') do %>
|
106
|
-
|
107
|
-
<style>
|
108
|
-
|
109
|
-
.case { background-color: white; }
|
110
|
-
.case .child { border: 1px red solid; }
|
111
|
-
|
112
|
-
.base {
|
113
|
-
float: left;
|
114
|
-
width: 200px;
|
115
|
-
height: 100px;
|
116
|
-
border: 1px #aaa solid;
|
117
|
-
position: relative;
|
118
|
-
margin: 2px;
|
119
|
-
}
|
120
|
-
|
121
|
-
.cases { position: absolute; bottom: 0 ; left: 0; right: 0; border-top: 1px #ccc solid; }
|
122
|
-
|
123
|
-
.base label {
|
124
|
-
position: absolute;
|
125
|
-
bottom: 4px;
|
126
|
-
left: 4px;
|
127
|
-
}
|
128
|
-
|
129
|
-
.nested_child { border: 1px green solid; }
|
130
|
-
|
131
|
-
.case {
|
132
|
-
position: absolute;
|
133
|
-
left: 10px;
|
134
|
-
top: 10px;
|
135
|
-
width: 30px;
|
136
|
-
height: 30px;
|
137
|
-
}
|
138
|
-
|
139
|
-
</style>
|
140
|
-
|
141
|
-
<%= view :case2, :class => 'case', :inner_html => 'Case' %>
|
142
|
-
|
143
|
-
<%= view :root %>
|
144
|
-
|
145
|
-
<% end %>
|
146
|
-
|
147
|
-
<%= view :case3, :class => 'case', :inner_html => 'Case' %>
|